Fix crash when searching in an empty table

This commit is contained in:
Martin Kleusberg
2019-11-10 13:41:15 +01:00
parent fa3a844454
commit 3535bdbf62

View File

@@ -1080,6 +1080,10 @@ QModelIndex SqliteTableModel::nextMatch(const QModelIndex& start, const std::vec
// Wait until the row count is there
waitUntilIdle();
// Stop right away if there is no data in the table
if(rowCount() == 0)
return QModelIndex();
// Make sure the start position starts in a column from the list of columns to search in
QModelIndex pos = start;
if(std::find(column_list.begin(), column_list.end(), pos.column()) == column_list.end())