diff --git a/cockatrice/src/lineeditcompleter.cpp b/cockatrice/src/lineeditcompleter.cpp index 380518c8..6860295d 100644 --- a/cockatrice/src/lineeditcompleter.cpp +++ b/cockatrice/src/lineeditcompleter.cpp @@ -45,8 +45,7 @@ void LineEditCompleter::keyPressEvent(QKeyEvent * event) c->popup()->hide(); //Truncate the line to last space or whole string QString textValue = text(); - int lastIndexof = textValue.lastIndexOf(" "); - lastIndexof = qMax(0, lastIndexof); + int lastIndexof = qMax(0, textValue.lastIndexOf(" ")); QString finalString = textValue.left(lastIndexof); //Add a space if there's a word if (finalString != "")