X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Ftreemodel.cpp;fp=src%2Fclient%2Ftreemodel.cpp;h=006434c8cab5b62c0187f795a32f103629fe1abb;hp=8d6c8824ae8750d6eeb05bf40e5f014a26d8601b;hb=47b54cd3ad35201ff2ab9ef6bfdba83fc086558d;hpb=0b277c98276e042f472e96f3eef9297a04f214f8 diff --git a/src/client/treemodel.cpp b/src/client/treemodel.cpp index 8d6c8824..006434c8 100644 --- a/src/client/treemodel.cpp +++ b/src/client/treemodel.cpp @@ -569,6 +569,12 @@ void TreeModel::debug_rowsAboutToBeRemoved(const QModelIndex& parent, int start, parentItem = rootItem; qDebug() << "debug_rowsAboutToBeRemoved" << parent << parentItem << parent.data().toString() << rowCount(parent) << start << end; + // Make sure model is valid first + if (!parent.model()) { + qDebug() << "Parent model is not valid!" << end; + return; + } + QModelIndex child; for (int i = end; i >= start; i--) { child = parent.model()->index(i, 0, parent); @@ -585,6 +591,12 @@ void TreeModel::debug_rowsInserted(const QModelIndex& parent, int start, int end parentItem = rootItem; qDebug() << "debug_rowsInserted:" << parent << parentItem << parent.data().toString() << rowCount(parent) << start << end; + // Make sure model is valid first + if (!parent.model()) { + qDebug() << "Parent model is not valid!" << end; + return; + } + QModelIndex child; for (int i = start; i <= end; i++) { child = parent.model()->index(i, 0, parent);