forked from qt-creator/qt-creator
QmlDesigner: Add nullptr checks in ActionEditor
Encountered an odd nullptr in QmlJS::Value *value. Change-Id: I9140ee15f01a430477b808aa7b664f5c40889c30 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -132,8 +132,7 @@ bool isLiteral(QmlJS::AST::Node *ast)
|
|||||||
|| QmlJS::AST::cast<QmlJS::AST::TrueLiteral *>(ast)
|
|| QmlJS::AST::cast<QmlJS::AST::TrueLiteral *>(ast)
|
||||||
|| QmlJS::AST::cast<QmlJS::AST::FalseLiteral *>(ast))
|
|| QmlJS::AST::cast<QmlJS::AST::FalseLiteral *>(ast))
|
||||||
return true;
|
return true;
|
||||||
else
|
return false;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TypeName skipCpp(TypeName typeName)
|
TypeName skipCpp(TypeName typeName)
|
||||||
@@ -229,16 +228,18 @@ void ActionEditor::prepareConnections()
|
|||||||
QmlJS::AST::ExpressionNode *expression = newDoc->expression();
|
QmlJS::AST::ExpressionNode *expression = newDoc->expression();
|
||||||
|
|
||||||
if (expression && !isLiteral(expression)) {
|
if (expression && !isLiteral(expression)) {
|
||||||
QmlJS::ValueOwner *interp = context->valueOwner();
|
if (QmlJS::ValueOwner *interp = context->valueOwner()) {
|
||||||
const QmlJS::Value *value = interp->convertToObject(scopeChain.evaluate(expression));
|
if (const QmlJS::Value *value = interp->convertToObject(
|
||||||
|
scopeChain.evaluate(expression))) {
|
||||||
|
if (value->asNullValue() && !methodBlackList.contains(slotName))
|
||||||
|
connection.methods.append(QString::fromUtf8(slotName));
|
||||||
|
|
||||||
if (value->asNullValue() && !methodBlackList.contains(slotName))
|
if (const QmlJS::FunctionValue *f = value->asFunctionValue()) {
|
||||||
connection.methods.append(QString::fromUtf8(slotName));
|
// Only add slots with zero arguments
|
||||||
|
if (f->namedArgumentCount() == 0 && !methodBlackList.contains(slotName))
|
||||||
if (const QmlJS::FunctionValue *f = value->asFunctionValue()) {
|
connection.methods.append(QString::fromUtf8(slotName));
|
||||||
// Only add slots with zero arguments
|
}
|
||||||
if (f->namedArgumentCount() == 0 && !methodBlackList.contains(slotName))
|
}
|
||||||
connection.methods.append(QString::fromUtf8(slotName));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user