diff --git a/src/log_parse.cpp b/src/log_parse.cpp index f4f8e3c..6b9691f 100644 --- a/src/log_parse.cpp +++ b/src/log_parse.cpp @@ -3,10 +3,14 @@ #include std::optional log_parse_line(std::string_view line) { + if (line.empty()) { + return std::nullopt; + } + static const std::regex mod_match{".*Factorio-Event-Logger+.*\\[([A-Z ]+)\\] (.+)$"}; std::cmatch matches; - if (!std::regex_match(line.cbegin(), line.cend(), matches, mod_match)) { + if (!std::regex_match(line.data(), line.data() + line.size(), matches, mod_match)) { return std::nullopt; }