Skip to content

Commit

Permalink
Potential crash on empty search string
Browse files Browse the repository at this point in the history
  • Loading branch information
sasq64 committed Nov 9, 2017
1 parent 2887ffe commit 476923e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/SearchIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -326,7 +331,7 @@ unsigned int SearchIndex::tlcode(const char *s) {

int SearchIndex::search(const string &q, vector<int> &result, unsigned int searchLimit) {


// result.resize(0);
// if(q.size() < 3)
// return 0;
Expand Down

0 comments on commit 476923e

Please sign in to comment.