diff options
author | Lu YaNing <luyaning@uniontech.com> | 2023-01-03 14:50:53 +0800 |
---|---|---|
committer | Lu YaNing <luyaning@uniontech.com> | 2023-01-08 20:03:43 +0800 |
commit | c53e12f25da6330767e7024164fc228169b3df42 (patch) | |
tree | 0e6762d3b7c8ba6617eeb2694604ed3da7aaf6e5 /src/qml/compiler/qv4compilerscanfunctions.cpp | |
parent | 6a816a9e0dfc2b41a4f86c721679f2517ec27eb6 (diff) | |
download | qtdeclarative-c53e12f25da6330767e7024164fc228169b3df42.tar.gz |
Add Q_ASSERT for _context pointer to avoid null pointer dereference
Amends to ae1334d827bd386ae34ed5fca8f00dcef83bc65e
Pick-to: 6.5
Change-Id: Ie9ed277b7462268d778e7148ce7e67655b420154
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compilerscanfunctions.cpp')
-rw-r--r-- | src/qml/compiler/qv4compilerscanfunctions.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4compilerscanfunctions.cpp b/src/qml/compiler/qv4compilerscanfunctions.cpp index 380cf66f47..f667548878 100644 --- a/src/qml/compiler/qv4compilerscanfunctions.cpp +++ b/src/qml/compiler/qv4compilerscanfunctions.cpp @@ -416,9 +416,10 @@ bool ScanFunctions::visit(TemplateLiteral *ast) bool ScanFunctions::visit(SuperLiteral *) { + Q_ASSERT(_context); Context *c = _context; bool needContext = false; - while (c && (c->contextType == ContextType::Block || c->isArrowFunction)) { + while (c->contextType == ContextType::Block || c->isArrowFunction) { needContext |= c->isArrowFunction; c = c->parent; } |