Handles empty pattern strings

Skips processing when encountering an empty string slice during pattern scanning.
This prevents unexpected behavior and potential errors when the pattern string contains sections that result in an empty byte string.
This commit is contained in:
2025-10-04 18:33:57 +03:00
parent 544fa313c1
commit 6319aa81ab

View File

@@ -24,8 +24,10 @@ namespace omath
const std::string_view byte_str = pattern_string.substr(sting_view_start, sting_view_end); const std::string_view byte_str = pattern_string.substr(sting_view_start, sting_view_end);
if (byte_str.empty()) if (byte_str.empty())
{
start = end != pattern_string.end() ? std::next(end) : end;
continue; continue;
}
if (byte_str == "?" || byte_str == "??") if (byte_str == "?" || byte_str == "??")
{ {
pattern.emplace_back(std::nullopt); pattern.emplace_back(std::nullopt);