forked from qt-creator/qt-creator
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: Marco Bubke <marco.bubke@digia.com>
This commit is contained in:
@@ -158,7 +158,10 @@ public:
|
||||
}
|
||||
if (m_action->isEnabled()) {
|
||||
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);
|
||||
selectionAction->setParent(m_menu.data());
|
||||
|
||||
|
Reference in New Issue
Block a user