Fix selecting invalid dive site

This patch fixes an invalid dive site selection when
you where typing the name of a dive site for your current
dive.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-10-01 16:27:22 -03:00 committed by Dirk Hohndel
parent f1558b86da
commit d032373caf

View file

@ -545,8 +545,8 @@ void DiveLocationLineEdit::fixPopupPosition()
}
view->setGeometry(pos.x(), pos.y(), w, h);
if (!view->currentIndex().isValid()) {
view->setCurrentIndex(view->model()->index(0, 1));
if (!view->currentIndex().isValid() && view->model()->rowCount()) {
view->setCurrentIndex(view->model()->index(0, 0));
}
}