summaryrefslogtreecommitdiffstats
path: root/sigmodr/tree/TreeModel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sigmodr/tree/TreeModel.cpp')
-rw-r--r--sigmodr/tree/TreeModel.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/sigmodr/tree/TreeModel.cpp b/sigmodr/tree/TreeModel.cpp
index a3b2f243..8331d7a2 100644
--- a/sigmodr/tree/TreeModel.cpp
+++ b/sigmodr/tree/TreeModel.cpp
@@ -52,6 +52,8 @@ QModelIndex TreeModel::parent(const QModelIndex& child) const
if (!child.isValid())
return QModelIndex();
TreeItem* item = static_cast<TreeItem*>(child.internalPointer());
+ if (!item->parent())
+ return QModelIndex();
return createIndex(item->row(), 0, item->parent());
}