Dirk,

I think this fixes the issue you described.

Tomaz
From 707b2fdf5fb1158d20c41376c81a2b19baf686bd Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Thu, 1 Oct 2015 16:27:22 -0300
Subject: [PATCH] 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 <[email protected]>
---
 qt-ui/locationinformation.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp
index 0d3d662..c03b0e8 100644
--- a/qt-ui/locationinformation.cpp
+++ b/qt-ui/locationinformation.cpp
@@ -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));
 	}
 }
 
-- 
2.6.0

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to