From 7155a10bb73535bc8df9483ec45efbaaf263ddea Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Mon, 3 Jul 2017 12:37:16 +0200 Subject: [PATCH] QmlDesigner: Fix potential crash Ensure the navigator is not crashing if no model is attached. Task-number: QTCREATORBUG-18420 Change-Id: I2748e61d34621167ff5908409046f8171ff76c85 Reviewed-by: Tim Jenssen --- .../qmldesigner/components/navigator/navigatortreemodel.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp index 8740a3d7937..142127c6c28 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp @@ -331,6 +331,9 @@ ModelNode NavigatorTreeModel::modelNodeForIndex(const QModelIndex &index) const if (!index.isValid()) return ModelNode(); + if (!m_view->model()) + return ModelNode(); + return m_view->modelNodeForInternalId(index.internalId()); }