summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksei German <aleksei.german@qt.io>2022-12-01 19:05:21 +0100
committerAleksei German <aleksei.german@qt.io>2022-12-01 20:30:56 +0000
commit44cfc4a8cda8a39a83ebb4e0a7ea0b86b74ef8b0 (patch)
tree4c8c5580c4ec6b2d927c9087c33d94c300d556d1
parentd9054d1f10cffb3ed957204287add76df58a78d3 (diff)
downloadqt-creator-44cfc4a8cda8a39a83ebb4e0a7ea0b86b74ef8b0.tar.gz
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>
-rw-r--r--src/plugins/qmldesigner/components/bindingeditor/actioneditor.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/plugins/qmldesigner/components/bindingeditor/actioneditor.cpp b/src/plugins/qmldesigner/components/bindingeditor/actioneditor.cpp
index ba2e439fca..cfb163fd77 100644
--- a/src/plugins/qmldesigner/components/bindingeditor/actioneditor.cpp
+++ b/src/plugins/qmldesigner/components/bindingeditor/actioneditor.cpp
@@ -132,8 +132,7 @@ 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;
+ return false;
}
TypeName skipCpp(TypeName typeName)
@@ -229,16 +228,18 @@ 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 (value->asNullValue() && !methodBlackList.contains(slotName))
- connection.methods.append(QString::fromUtf8(slotName));
-
- if (const QmlJS::FunctionValue *f = value->asFunctionValue()) {
- // Only add slots with zero arguments
- if (f->namedArgumentCount() == 0 && !methodBlackList.contains(slotName))
- connection.methods.append(QString::fromUtf8(slotName));
+ 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));
+
+ if (const QmlJS::FunctionValue *f = value->asFunctionValue()) {
+ // Only add slots with zero arguments
+ if (f->namedArgumentCount() == 0 && !methodBlackList.contains(slotName))
+ connection.methods.append(QString::fromUtf8(slotName));
+ }
+ }
}
}
}