File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -388,16 +388,24 @@ void QgsLocatorResultsView::recalculateSize()
388
388
389
389
void QgsLocatorResultsView::selectNextResult ()
390
390
{
391
+ const int rowCount = model ()->rowCount ( QModelIndex () );
392
+ if ( rowCount == 0 )
393
+ return ;
394
+
391
395
int nextRow = currentIndex ().row () + 1 ;
392
- nextRow = nextRow % model ()-> rowCount ( QModelIndex () ) ;
396
+ nextRow = nextRow % rowCount;
393
397
setCurrentIndex ( model ()->index ( nextRow, 0 ) );
394
398
}
395
399
396
400
void QgsLocatorResultsView::selectPreviousResult ()
397
401
{
402
+ const int rowCount = model ()->rowCount ( QModelIndex () );
403
+ if ( rowCount == 0 )
404
+ return ;
405
+
398
406
int previousRow = currentIndex ().row () - 1 ;
399
407
if ( previousRow < 0 )
400
- previousRow = model ()-> rowCount ( QModelIndex () ) - 1 ;
408
+ previousRow = rowCount - 1 ;
401
409
setCurrentIndex ( model ()->index ( previousRow, 0 ) );
402
410
}
403
411
You can’t perform that action at this time.
0 commit comments