Commit 37e603bc authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.ContextMenu: Fixing possible crash



If an item is created but not (yet) in the hierarchy, but gets selected,
the parent property is not valid. We should check for this case.

Change-Id: I965bc20172bfd58b0b1759d3b0907971dfe142f1
Reviewed-by: default avatarMarco Bubke <marco.bubke@digia.com>
parent 521bb915
...@@ -158,7 +158,10 @@ public: ...@@ -158,7 +158,10 @@ public:
} }
if (m_action->isEnabled()) { if (m_action->isEnabled()) {
ModelNode parentNode; ModelNode parentNode;
if (m_selectionContext.singleNodeIsSelected() && !m_selectionContext.currentSingleSelectedNode().isRootNode()) { if (m_selectionContext.singleNodeIsSelected()
&& !m_selectionContext.currentSingleSelectedNode().isRootNode()
&& m_selectionContext.currentSingleSelectedNode().hasParentProperty()) {
ActionTemplate *selectionAction = new ActionTemplate(QString(), &ModelNodeOperations::select); ActionTemplate *selectionAction = new ActionTemplate(QString(), &ModelNodeOperations::select);
selectionAction->setParent(m_menu.data()); selectionAction->setParent(m_menu.data());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment