Fixed crash with invalid category. Fixes #945.
This commit is contained in:
@@ -184,7 +184,7 @@ bool lcMatchCategory(const char* PieceName, const char* Expression)
|
||||
}
|
||||
else if ((*p == '|') || (*p == '&'))
|
||||
{
|
||||
std::string LeftStr(Expression, (p - Expression) - 1);
|
||||
std::string LeftStr(Expression, std::max(p - Expression, static_cast<ptrdiff_t>(1)) - 1);
|
||||
std::string RightStr(p + 1);
|
||||
|
||||
if (*p == '|')
|
||||
@@ -258,6 +258,9 @@ bool lcMatchCategory(const char* PieceName, const char* Expression)
|
||||
Word++;
|
||||
}
|
||||
|
||||
if (!Word[0])
|
||||
return false;
|
||||
|
||||
const char* Result = strcasestr(PieceName, Word);
|
||||
|
||||
if (!Result)
|
||||
|
||||
Reference in New Issue
Block a user