From 612c5713b406d0805653234dce63778e92c29c61 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Sat, 16 Nov 2013 22:56:48 -0200 Subject: Fix crash when entering a dive via dive-add on a empty table. We were selecting garbage, not anymore. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/divelistview.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index 9f7517308..9779d60e7 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -152,6 +152,8 @@ void DiveListView::unselectDives() void DiveListView::selectDive(int i, bool scrollto, bool toggle) { + if( i == -1) + return; QSortFilterProxyModel *m = qobject_cast(model()); QModelIndexList match = m->match(m->index(0,0), DiveTripModel::DIVE_IDX, i, 2, Qt::MatchRecursive); QItemSelectionModel::SelectionFlags flags; -- cgit v1.2.3-70-g09d2