summaryrefslogtreecommitdiff
path: root/src/qml/compiler/qv4codegen.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2018-04-30 12:34:54 +0200
committerLars Knoll <lars.knoll@qt.io>2018-05-02 14:16:59 +0000
commit3f82c8131fed248c24ed8c8be7449b4732afcd0b (patch)
treedb9d38747763beafb5cacb8a848cf9989e241263 /src/qml/compiler/qv4codegen.cpp
parent6d0378ad9b91db04ca725b98d941d32871b19d82 (diff)
downloadqtdeclarative-3f82c8131fed248c24ed8c8be7449b4732afcd0b.tar.gz
Fix crashes when parsing functions with no parameters
Commit da5fffbd34d8be68f8ee4c649881dbb673c9c0a5 introduced deferencing of the formals parameter list that can be a null pointer if the declared function has no parameters. Change-Id: Id7dce0f78b16266e672f0ae430ee4f979de5734d Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
-rw-r--r--src/qml/compiler/qv4codegen.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index 0a46fc7a8e..4e6d56adcf 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -2425,7 +2425,7 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast,
}
}
if (_context->usesArgumentsObject == Context::ArgumentsObjectUsed) {
- if (_context->isStrict || !formals->isSimpleParameterList()) {
+ if (_context->isStrict || (formals && !formals->isSimpleParameterList())) {
Instruction::CreateUnmappedArgumentsObject setup;
bytecodeGenerator->addInstruction(setup);
} else {