From 11bc7b8fd8b0ba10e3410db0578b7aa6bc9adf50 Mon Sep 17 00:00:00 2001 From: luzh Date: Fri, 29 Dec 2023 21:26:49 +0800 Subject: [PATCH] [fix] judge nullptr --- ui/zenomodel/src/graphsmodel.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ui/zenomodel/src/graphsmodel.cpp b/ui/zenomodel/src/graphsmodel.cpp index 3bf8a0a874..0ecce04345 100644 --- a/ui/zenomodel/src/graphsmodel.cpp +++ b/ui/zenomodel/src/graphsmodel.cpp @@ -1700,11 +1700,13 @@ void GraphsModel::_markNodeChanged(const QModelIndex& nodeIdx) if (sockProp & SOCKPROP_DICTLIST_PANEL) { QAbstractItemModel* pKeyObjModel = QVariantPtr::asPtr(sock.data(ROLE_VPARAM_LINK_MODEL)); - for (int _r = 0; _r < pKeyObjModel->rowCount(); _r++) - { - const QModelIndex& keyIdx = pKeyObjModel->index(_r, 0); - ZASSERT_EXIT(keyIdx.isValid()); - socketLst << keyIdx; + if (pKeyObjModel) { + for (int _r = 0; _r < pKeyObjModel->rowCount(); _r++) + { + const QModelIndex& keyIdx = pKeyObjModel->index(_r, 0); + ZASSERT_EXIT(keyIdx.isValid()); + socketLst << keyIdx; + } } } else