From 6a4511099f2fe0eb5fb7222f286daba65661d7d0 Mon Sep 17 00:00:00 2001 From: tastytea Date: Tue, 1 Jun 2021 20:15:05 +0200 Subject: [PATCH] Do not add empty matches to matches_all. --- src/main.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index f4e0090..b3f1680 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -150,8 +150,11 @@ int main(int argc, char *argv[]) { auto matches{ search::search(filepath, regex, search_settings)}; - std::lock_guard guard(mutex_matches_all); - matches_all.emplace_back(matches); + if (!matches.empty()) + { + std::lock_guard guard(mutex_matches_all); + matches_all.emplace_back(matches); + } } catch (const zip::exception &e) {