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