From 5105d6a33316e87fe59652c461df8ad7ca07fb0e Mon Sep 17 00:00:00 2001 From: Amit Chaudhuri Date: Sat, 11 May 2013 11:38:24 +0100 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/models.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qt-ui') 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(index.internalPointer()); TreeItemDT* parentItem = childItem->parent; - if (parentItem == rootItem) + if (parentItem == rootItem || !parentItem) return QModelIndex(); return createIndex(parentItem->row(), 0, parentItem); -- cgit v1.2.3-70-g09d2