From bf28c2e3f43038165dc83c10267d103e779b245e Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 30 Nov 2015 13:45:51 +0100 Subject: ModelResult: return an invalid QModelIndex for the toplevel parent --- common/modelresult.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/modelresult.cpp b/common/modelresult.cpp index 4def20f..e2a05f8 100644 --- a/common/modelresult.cpp +++ b/common/modelresult.cpp @@ -100,6 +100,9 @@ QModelIndex ModelResult::index(int row, int column, const QModelIndex &p template QModelIndex ModelResult::createIndexFromId(const qint64 &id) const { + if (id == 0) { + return QModelIndex(); + } auto grandParentId = mParents.value(id, 0); auto row = mTree.value(grandParentId).indexOf(id); return createIndex(row, 0, id); -- cgit v1.2.3