aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2022-05-12 12:20:40 +0200
committerGitHub <[email protected]>2022-05-12 12:20:40 +0200
commit0de058beb148713a5b3a6fefaf38a5684163ac37 (patch)
treec483458c58cf04abc5bdd161755ffde57d9acfcb
parentd438bd970a621db7e158936459922f8165ccee78 (diff)
parenta6caac2b61de0f1edfc2db1ec695218e4c8be7ea (diff)
downloadHyprland-0de058beb148713a5b3a6fefaf38a5684163ac37.tar.gz
Hyprland-0de058beb148713a5b3a6fefaf38a5684163ac37.zip
Merge pull request #69 from mdartmann/fix-underflow-remove-begin-end-spaces-tabs
Fix string underflow in `removeBeginEndSpacesTabs()`
-rw-r--r--src/helpers/MiscFunctions.cpp2
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);
}