summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Amit Chaudhuri <amit.k.chaudhuri@gmail.com>2013-05-11 11:38:24 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-11 06:51:19 -0700
commit5105d6a33316e87fe59652c461df8ad7ca07fb0e (patch)
treef11e9c917b2ba577a152004ce070bdd8f0047188 /qt-ui
parent06d296a17da927131ef8de511d0f9bf56dab0535 (diff)
downloadsubsurface-5105d6a33316e87fe59652c461df8ad7ca07fb0e.tar.gz
Fix crash in DiveTripModel.
A left click in the treeview header leads to a call to createIndex which results in a null pointer dereference. Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/models.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index 9a6edce98..90143b912 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -650,7 +650,7 @@ QModelIndex DiveTripModel::parent(const QModelIndex& index) const
TreeItemDT* childItem = static_cast<TreeItemDT*>(index.internalPointer());
TreeItemDT* parentItem = childItem->parent;
- if (parentItem == rootItem)
+ if (parentItem == rootItem || !parentItem)
return QModelIndex();
return createIndex(parentItem->row(), 0, parentItem);