diff --git a/lib/filter.cpp b/lib/filter.cpp index c18408c7..06102936 100644 --- a/lib/filter.cpp +++ b/lib/filter.cpp @@ -106,17 +106,17 @@ void filter :: search(const std::string &text, std::set &res) { std::list parsed; std::list::iterator it; + IndexEntry *found; parse_text(text, parsed); if (parsed.size() == 0) return; it = parsed.begin(); - try { - res = filter_index.find(*it)->values; - } catch (...) { + found = filter_index.find(*it); + if (!found) return; - } + res = found->values; for (it++; it != parsed.end(); it++) find_intersection(*it, res); diff --git a/tests/filter b/tests/filter index fa2cad0f..a6896b43 100755 --- a/tests/filter +++ b/tests/filter @@ -69,3 +69,4 @@ test_search "the" "4 5 6 8" test_search "the ch" "4 6" test_search "the CH" "4 6" test_search "the ch y" "4" +test_search "unknown terms" ""