diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2025-08-11 09:58:21 +0200 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2025-08-12 12:27:32 +0200 |
| commit | b88759fc5df44c04018d6f47507abcf026bf4325 (patch) | |
| tree | c0cc8890a39403382feaff7b7e8b1847e717449e /src/qml/jsruntime/qv4module.cpp | |
| parent | 27ad8d93960027e99aa860f20eb5fbf7b6845c14 (diff) | |
QtQml: Properly null-check module exports when iterating
We construct the iterator from the exports of the module in all current
code paths. Therefore, this case can't happen in the current code.
Still, the fact that we have a branch that throws a reference error
there tells us that it's intended to work on other collections of names,
too. Let's complete the check and also check for nullptr since
resolveExport can indeed return that.
Coverity-Id: 486706
Change-Id: Ieaf3996e76265e9e6ef59c2168699e47e41e8ff5
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4module.cpp')
| -rw-r--r-- | src/qml/jsruntime/qv4module.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4module.cpp b/src/qml/jsruntime/qv4module.cpp index 8e075251e4..3ff9191cb2 100644 --- a/src/qml/jsruntime/qv4module.cpp +++ b/src/qml/jsruntime/qv4module.cpp @@ -203,9 +203,9 @@ PropertyKey ModuleNamespaceIterator::next(const Object *o, Property *pd, Propert Scope scope(module->engine()); ScopedString exportName(scope, scope.engine->newString(exportedNames.at(exportIndex))); exportIndex++; - const Value *v = module->resolveExport(exportName->toPropertyKey()); if (pd) { - if (v->isEmpty()) + const Value *v = module->resolveExport(exportName->toPropertyKey()); + if (!v || v->isEmpty()) scope.engine->throwReferenceError(exportName); else pd->value = *v; |
