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>
This commit is contained in:
Tomaz Canabrava 2013-11-16 22:56:48 -02:00 committed by Dirk Hohndel
parent 47c833015b
commit 612c5713b4

View file

@ -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;