guard empty str in removeBeginEndSpacesTabs

This commit is contained in:
vaxerski 2022-11-10 21:51:46 +00:00
parent 0208dff574
commit a5ffd44caf

View file

@ -145,6 +145,9 @@ void scaleBox(wlr_box* box, float scale) {
} }
std::string removeBeginEndSpacesTabs(std::string str) { std::string removeBeginEndSpacesTabs(std::string str) {
if (str.empty())
return str;
int countBefore = 0; int countBefore = 0;
while (str[countBefore] == ' ' || str[countBefore] == '\t') { while (str[countBefore] == ' ' || str[countBefore] == '\t') {
countBefore++; countBefore++;