Commit a30c0161 authored by Christian Kamm's avatar Christian Kamm
Browse files

QmlJS: Fix several crashes when UiQualifiedId::name is 0.

Task-number: QTCREATORBUG-2737
Reviewed-by: Kai Koehne
parent 6688b614
......@@ -241,7 +241,7 @@ bool Bind::visit(UiObjectDefinition *ast)
// think anchors { ... }
bool isGroupedBinding = false;
for (UiQualifiedId *it = ast->qualifiedTypeNameId; it; it = it->next) {
if (!it->next)
if (!it->next && it->name)
isGroupedBinding = it->name->asString().at(0).isLower();
}
......
......@@ -256,7 +256,8 @@ QString Rewriter::flatten(UiQualifiedId *first)
if (current != first)
flatId += '.';
flatId += current->name->asString();
if (current->name)
flatId += current->name->asString();
}
return flatId;
......
......@@ -228,7 +228,7 @@ void ScopeBuilder::setQmlScopeObject(Node *node)
if (initializer) {
for (UiObjectMemberList *m = initializer->members; m; m = m->next) {
if (UiScriptBinding *scriptBinding = cast<UiScriptBinding *>(m->member)) {
if (scriptBinding->qualifiedId
if (scriptBinding->qualifiedId && scriptBinding->qualifiedId->name
&& scriptBinding->qualifiedId->name->asString() == QLatin1String("target")
&& ! scriptBinding->qualifiedId->next) {
// ### make Evaluate understand statements.
......@@ -256,6 +256,8 @@ const Value *ScopeBuilder::scopeObjectLookup(AST::UiQualifiedId *id)
foreach (const ObjectValue *scopeObject, _context->scopeChain().qmlScopeObjects) {
const ObjectValue *object = scopeObject;
for (UiQualifiedId *it = id; it; it = it->next) {
if (!it->name)
return 0;
result = object->property(it->name->asString(), _context);
if (!result)
break;
......
......@@ -468,7 +468,7 @@ private:
bool checkBindingName(UiQualifiedId *id)
{
if (id && !id->next && containsOffset(id->identifierToken)) {
if (id && id->name && !id->next && containsOffset(id->identifierToken)) {
_result.second = id->name->asString();
return true;
}
......
Supports Markdown
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