diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-05-07 09:29:12 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-05-19 06:09:37 +0000 |
commit | 98277a1e8f7bc7a32035e9ade9a55a4f51d8dd80 (patch) | |
tree | 99edb351cad0f96b3e9f5b569f86a3b94d8e380f /src/qml/compiler/qv4compilercontext.cpp | |
parent | 3e2d749a5e208a187312d354754990adc41ddfe3 (diff) |
qv4compilercontext: avoid potential null deference
Coverity-Id: 274162
Pick-to: 5.15
Change-Id: I58e23d600e9778f5149258fac58657c1a165e0c0
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compilercontext.cpp')
-rw-r--r-- | src/qml/compiler/qv4compilercontext.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4compilercontext.cpp b/src/qml/compiler/qv4compilercontext.cpp index 872fc94dc9..08fb2ee993 100644 --- a/src/qml/compiler/qv4compilercontext.cpp +++ b/src/qml/compiler/qv4compilercontext.cpp @@ -174,7 +174,10 @@ Context::ResolvedName Context::resolveName(const QString &name, const QQmlJS::So c = c->parent; } - if (c && c->contextType == ContextType::ESModule) { + if (!c) + return result; + + if (c->contextType == ContextType::ESModule) { for (int i = 0; i < c->importEntries.count(); ++i) { if (c->importEntries.at(i).localName == name) { result.index = i; |