Commit 3a95f3f4 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner: Crash fix



The string "id" is not a valid property name.
Calling name() on an invalid property should not throw,
since it cannot have side effects and is required for e.g.
error messages.

Change-Id: I8b199ebc14fc1d9ed5796bd1bc7f15491c1bb3ec
Reviewed-by: default avatarTim Jenssen <tim.jenssen@theqtcompany.com>
parent ee5ec831
......@@ -123,10 +123,6 @@ AbstractView *AbstractProperty::view() const
*/
PropertyName AbstractProperty::name() const
{
if (m_propertyName == "id") { // the ID for a node is independent of the state, so it has to be set with ModelNode::setId
Q_ASSERT_X(0, Q_FUNC_INFO, "id is not a property in the model");
throw InvalidPropertyException(__LINE__, __FUNCTION__, __FILE__, name());
}
return m_propertyName;
}
......@@ -144,7 +140,9 @@ bool AbstractProperty::isValid() const
return !m_internalNode.isNull() &&
!m_model.isNull() &&
m_internalNode->isValid() &&
!m_propertyName.isEmpty();
!m_propertyName.isEmpty() &&
!m_propertyName.contains(' ') &&
m_propertyName != "id";
}
/*!
......
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