diff --git a/common/lc_category.cpp b/common/lc_category.cpp index 83de802b..3899f423 100644 --- a/common/lc_category.cpp +++ b/common/lc_category.cpp @@ -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(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)