summaryrefslogtreecommitdiffstats
path: root/qt-ui/divelistview.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-11-16 22:56:48 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-16 20:33:21 -0800
commit612c5713b406d0805653234dce63778e92c29c61 (patch)
treee07fa45963fb2a9b2351c2c54d0da2f8ae61a7d3 /qt-ui/divelistview.cpp
parent47c833015b28f154e56505a769b6353db613bbc4 (diff)
downloadsubsurface-612c5713b406d0805653234dce63778e92c29c61.tar.gz
Fix crash when entering a dive via dive-add on a empty table.
We were selecting garbage, not anymore. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r--qt-ui/divelistview.cpp2
1 files changed, 2 insertions, 0 deletions
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<QSortFilterProxyModel*>(model());
QModelIndexList match = m->match(m->index(0,0), DiveTripModel::DIVE_IDX, i, 2, Qt::MatchRecursive);
QItemSelectionModel::SelectionFlags flags;