avoid access violation with empty string s -> length == 0

This commit is contained in:
Christian Grasser 2015-06-11 11:22:05 +02:00
parent 4cfdd40497
commit 9d9be045ae

View File

@ -635,13 +635,13 @@ static inline void SubGroup(const char * s, vvstring & vec, bool group=false)
for (unsigned int j=0; j<length+1; ++j)
temp[j] = 0;
if (s[0] == '(' && s[1] == '(')
if (length >= 2 && s[0] == '(' && s[1] == '(')
{
i = 2;
group = true;
}
if (s[length-1] == ')' && s[length-2] == ')')
if (length >= 2 && s[length - 1] == ')' && s[length - 2] == ')')
length -= 2;
if (!group && *s)