StringUtils: Fixed StringSplitWithQuotes().
The function would crash when given a string that started with the delimiter.
This commit is contained in:
parent
87f1cf5622
commit
b356419a07
@ -150,6 +150,13 @@ AStringVector StringSplitWithQuotes(const AString & str, const AString & delim)
|
|||||||
|
|
||||||
while ((cutAt = str.find_first_of(delim, Prev)) != str.npos)
|
while ((cutAt = str.find_first_of(delim, Prev)) != str.npos)
|
||||||
{
|
{
|
||||||
|
if (cutAt == Prev)
|
||||||
|
{
|
||||||
|
// Empty string due to multiple whitespace / whitespace at the beginning of the input
|
||||||
|
// Just skip it
|
||||||
|
Prev = Prev + 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
AString current = str.substr(Prev, cutAt - Prev);
|
AString current = str.substr(Prev, cutAt - Prev);
|
||||||
if ((current.front() == '"') || (current.front() == '\''))
|
if ((current.front() == '"') || (current.front() == '\''))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user