SERVER-3991 (reissue) -- don't index past end of string

This is a reissue of my earlier fix. I'm trying to break them down into
bite-sized parts to make them easier to pull.

Break out of the for() loop once we've advanced the counter past the end.
Skip the test for dangling operator (no character to examine, we're inside
a quoted string) and set danglingOp = false.
This commit is contained in:
Tad Marshall
2011-10-12 15:50:31 -04:00
parent c5e9162870
commit 443ecbfb44

View File

@@ -453,7 +453,10 @@ bool isBalanced( string code ) {
}
break;
}
if (i>=code.size()) {
danglingOp = false;
break;
}
if ( isOpSymbol( code[i] )) danglingOp = true;
else if (! std::isspace( code[i] )) danglingOp = false;
}