diff options
| author | Lu YaNing <luyaning@uniontech.com> | 2023-01-03 14:50:53 +0800 |
|---|---|---|
| committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-01-08 14:41:46 +0000 |
| commit | 6e3e205cc56bbe8933d84f83273e7856eac11546 (patch) | |
| tree | d6048e397f9a57caa1ea6f9283fa8c633a2d475c /src/qml/compiler/qv4compilerscanfunctions.cpp | |
| parent | 65b32630352c651441af9de849bba891efc97fd2 (diff) | |
Add Q_ASSERT for _context pointer to avoid null pointer dereference
Amends to ae1334d827bd386ae34ed5fca8f00dcef83bc65e
Change-Id: Ie9ed277b7462268d778e7148ce7e67655b420154
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit c53e12f25da6330767e7024164fc228169b3df42)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
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; } |
