Qt text search crash fix

About 5 weeks ago, commit e4106bb161
changed Qt's searching in text windows to be able to find a match
on the very first line.  It assumed that the first line would be
the current line except when repeating the same search after a
match.  But after a failed search the current line index is -1 and
starting a new search would crash trying to look that line up.
This commit is contained in:
PatR
2020-12-11 18:11:27 -08:00
parent 0d0900b3a4
commit 5b709fcb55

View File

@@ -1192,6 +1192,8 @@ void NetHackQtTextWindow::Search()
if (get_a_line) {
int linecount = lines->count();
int current = lines->currentRow();
if (current == -1)
current = 0;
// when no row is highlighted (selected), start the search
// on the current row, otherwise start on the row after it
// [normally means that the very first row is a candidate