Fix string underflow in removeBeginEndSpacesTabs()

Signed-off-by: Mae Dartmann <hello@maedartmann.name>

 Changes to be committed:
	modified:   src/helpers/MiscFunctions.cpp
This commit is contained in:
Mae Dartmann 2022-05-12 12:08:18 +02:00
parent ac7903f521
commit a6caac2b61
No known key found for this signature in database
GPG key ID: 844402F3B2C2CDC5

View file

@ -69,7 +69,7 @@ std::string removeBeginEndSpacesTabs(std::string str) {
str = str.substr(1); 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); str = str.substr(0, str.length() - 1);
} }