From a5ffd44cafd84f6f324e27c1925573e6cabcc858 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 10 Nov 2022 21:51:46 +0000 Subject: [PATCH] guard empty str in removeBeginEndSpacesTabs --- src/helpers/MiscFunctions.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp index c825a1d97..bf20f3904 100644 --- a/src/helpers/MiscFunctions.cpp +++ b/src/helpers/MiscFunctions.cpp @@ -145,6 +145,9 @@ void scaleBox(wlr_box* box, float scale) { } std::string removeBeginEndSpacesTabs(std::string str) { + if (str.empty()) + return str; + int countBefore = 0; while (str[countBefore] == ' ' || str[countBefore] == '\t') { countBefore++;