diff options
Diffstat (limited to 'smtreemodel.cpp')
-rw-r--r-- | smtreemodel.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/smtreemodel.cpp b/smtreemodel.cpp index 088d393..4596a5b 100644 --- a/smtreemodel.cpp +++ b/smtreemodel.cpp @@ -62,8 +62,11 @@ QModelIndex SmTreeModel::parent(const QModelIndex &child) const{ } SmTreeItem *childItem = static_cast<SmTreeItem*>(child.internalPointer()); - SmTreeItem *parentItem = childItem->parent(); + if(childItem == mRootItem){ + return QModelIndex(); + } + SmTreeItem *parentItem = childItem->parent(); if(parentItem == mRootItem){ return QModelIndex(); } |