Skip to content

Commit 681a3b7

Browse files
committed
Fix logical error in postprocess_results()
The intention was to return no more than MAX_RESULTS, not to always return that much. This resulted in returning bogus empty strings in case of no matches and consequent pre-translation matching with empty fuzzy strings. Fixes ec6f6df.
1 parent d3c25a4 commit 681a3b7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/tm/transmem.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,8 @@ std::wstring get_text_field(DocumentPtr doc, const std::wstring& field)
365365
void postprocess_results(SuggestionsList& results)
366366
{
367367
std::stable_sort(results.begin(), results.end());
368-
results.resize(MAX_RESULTS);
368+
if (results.size() > MAX_RESULTS)
369+
results.resize(MAX_RESULTS);
369370
}
370371

371372

0 commit comments

Comments
 (0)