Fix segfault in get_until_delimiter
This commit is contained in:
parent
4ba99f7d6f
commit
8e0b5d67aa
|
@ -102,20 +102,20 @@ String get_until_delimiter(const String& base, ByteCount& pos, char delimiter)
|
||||||
{
|
{
|
||||||
const ByteCount length = base.length();
|
const ByteCount length = base.length();
|
||||||
String str;
|
String str;
|
||||||
while (true)
|
while (pos < length)
|
||||||
{
|
{
|
||||||
char c = base[pos];
|
char c = base[pos];
|
||||||
if (c == delimiter)
|
if (c == delimiter)
|
||||||
{
|
{
|
||||||
if (base[pos-1] != '\\')
|
if (base[pos-1] != '\\')
|
||||||
return str;
|
break;
|
||||||
str.back() = delimiter;
|
str.back() = delimiter;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
str += c;
|
str += c;
|
||||||
if (++pos == length)
|
++pos;
|
||||||
return str;
|
|
||||||
}
|
}
|
||||||
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
String get_until_delimiter(const String& base, ByteCount& pos,
|
String get_until_delimiter(const String& base, ByteCount& pos,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user