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:
Aleksei German
2022-12-01 19:05:21 +01:00
parent d9054d1f10
commit 44cfc4a8cd

View File

@@ -132,7 +132,6 @@ bool isLiteral(QmlJS::AST::Node *ast)
|| QmlJS::AST::cast<QmlJS::AST::TrueLiteral *>(ast)
|| QmlJS::AST::cast<QmlJS::AST::FalseLiteral *>(ast))
return true;
else
return false;
}
@@ -229,9 +228,9 @@ void ActionEditor::prepareConnections()
QmlJS::AST::ExpressionNode *expression = newDoc->expression();
if (expression && !isLiteral(expression)) {
QmlJS::ValueOwner *interp = context->valueOwner();
const QmlJS::Value *value = interp->convertToObject(scopeChain.evaluate(expression));
if (QmlJS::ValueOwner *interp = context->valueOwner()) {
if (const QmlJS::Value *value = interp->convertToObject(
scopeChain.evaluate(expression))) {
if (value->asNullValue() && !methodBlackList.contains(slotName))
connection.methods.append(QString::fromUtf8(slotName));
@@ -242,6 +241,8 @@ void ActionEditor::prepareConnections()
}
}
}
}
}
connection.methods.removeDuplicates();
connections.append(connection);