We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 6b2fe56 + 9c0863c commit 4fbc23cCopy full SHA for 4fbc23c
core/lexer.cpp
@@ -28,6 +28,7 @@ static const std::vector<std::string> EMPTY;
28
/** Strip whitespace from both ends of a string, but only up to margin on the left hand side. */
29
static std::string strip_ws(const std::string &s, unsigned margin)
30
{
31
+ if (s.size() == 0) return s; // Avoid underflow below.
32
size_t i = 0;
33
while (i < s.length() && (s[i] == ' ' || s[i] == '\t' || s[i] == '\r') && i < margin)
34
i++;
0 commit comments