diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-05-12 12:20:40 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-12 12:20:40 +0200 |
| commit | 0de058beb148713a5b3a6fefaf38a5684163ac37 (patch) | |
| tree | c483458c58cf04abc5bdd161755ffde57d9acfcb /src/helpers/MiscFunctions.cpp | |
| parent | d438bd970a621db7e158936459922f8165ccee78 (diff) | |
| parent | a6caac2b61de0f1edfc2db1ec695218e4c8be7ea (diff) | |
Merge pull request #69 from mdartmann/fix-underflow-remove-begin-end-spaces-tabs
Fix string underflow in `removeBeginEndSpacesTabs()`
Diffstat (limited to 'src/helpers/MiscFunctions.cpp')
| -rw-r--r-- | src/helpers/MiscFunctions.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp index bf8724c6..61ae0c49 100644 --- a/src/helpers/MiscFunctions.cpp +++ b/src/helpers/MiscFunctions.cpp @@ -69,7 +69,7 @@ std::string removeBeginEndSpacesTabs(std::string str) { str = str.substr(1); } - while (str[str.length() - 1] == ' ' || str[str.length() - 1] == '\t') { + while (str.length() != 0 && (str[str.length() - 1] == ' ' || str[str.length() - 1] == '\t')) { str = str.substr(0, str.length() - 1); } |
