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.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/sigmodr/tree/TreeModel.cpp b/sigmodr/tree/TreeModel.cpp
index 0ec202fc..cfccbcea 100644
--- a/sigmodr/tree/TreeModel.cpp
+++ b/sigmodr/tree/TreeModel.cpp
@@ -76,7 +76,7 @@ QModelIndex TreeModel::index(const int row, const int column, const QModelIndex&
return QModelIndex();
}
TreeItem* item = static_cast<TreeItem*>(parent.internalPointer());
- if (column || (row < 0) || (item->childCount() <= row))
+ if ((row < 0) || (item->childCount() <= row) || (column < 0) || (4 <= column))
return QModelIndex();
return createIndex(row, column, item->childAt(row));
}
@@ -108,6 +108,8 @@ int TreeModel::rowCount(const QModelIndex& parent) const
int TreeModel::columnCount(const QModelIndex& parent) const
{
+ if (!parent.isValid())
+ return 0;
return 4;
}