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 @@ -401,16 +401,24 @@ void QgsLocatorResultsView::recalculateSize()
401
401
402
402
void QgsLocatorResultsView::selectNextResult ()
403
403
{
404
+ const int rowCount = model ()->rowCount ( QModelIndex () );
405
+ if ( rowCount == 0 )
406
+ return ;
407
+
404
408
int nextRow = currentIndex ().row () + 1 ;
405
- nextRow = nextRow % model ()-> rowCount ( QModelIndex () ) ;
409
+ nextRow = nextRow % rowCount;
406
410
setCurrentIndex ( model ()->index ( nextRow, 0 ) );
407
411
}
408
412
409
413
void QgsLocatorResultsView::selectPreviousResult ()
410
414
{
415
+ const int rowCount = model ()->rowCount ( QModelIndex () );
416
+ if ( rowCount == 0 )
417
+ return ;
418
+
411
419
int previousRow = currentIndex ().row () - 1 ;
412
420
if ( previousRow < 0 )
413
- previousRow = model ()-> rowCount ( QModelIndex () ) - 1 ;
421
+ previousRow = rowCount - 1 ;
414
422
setCurrentIndex ( model ()->index ( previousRow, 0 ) );
415
423
}
416
424
You can’t perform that action at this time.
0 commit comments