From 476923edc28fdfb5b57e4673dcf99461eba3ecb0 Mon Sep 17 00:00:00 2001 From: Jonas Minnberg Date: Thu, 9 Nov 2017 16:04:55 +0100 Subject: [PATCH] Potential crash on empty search string --- src/SearchIndex.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/SearchIndex.cpp b/src/SearchIndex.cpp index 0d69331..6c8c2d4 100644 --- a/src/SearchIndex.cpp +++ b/src/SearchIndex.cpp @@ -192,10 +192,15 @@ void IncrementalQuery::search() { lastStart = -1; newRes = true; + if(query.size() == 0) { + finalResult.resize(0); + return; + } + string q = string(&query[0], query.size()); auto words = split(q); - + // Words : IRON LORD -> 3L= "IRO" // Remove empty strings @@ -326,7 +331,7 @@ unsigned int SearchIndex::tlcode(const char *s) { int SearchIndex::search(const string &q, vector &result, unsigned int searchLimit) { - + // result.resize(0); // if(q.size() < 3) // return 0;