Fix command parsing bug

Fixes #347
This commit is contained in:
Maxime Coste 2015-07-30 09:41:23 +01:00
parent 0b01f1eb06
commit 19c52c3d61

View File

@ -100,7 +100,8 @@ String get_until_delimiter(StringView base, ByteCount& pos, char delimiter)
}
++pos;
}
str += base.substr(beg, pos - beg);
if (beg < length)
str += base.substr(beg, pos - beg);
return str;
}
@ -179,7 +180,7 @@ Token parse_percent_token(StringView line, ByteCount& pos)
{
const ByteCount length = line.length();
const ByteCount type_start = ++pos;
while (isalpha(line[pos]))
while (pos < length and isalpha(line[pos]))
++pos;
StringView type_name = line.substr(type_start, pos - type_start);