diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2023-10-18 11:37:37 +0200 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2023-10-24 18:44:55 +0200 |
| commit | 604da0a395840d7370cde1a55db460156c3a3e8c (patch) | |
| tree | a77f5f9727a4f100db4472c4d01df08517eda873 /src/qml/jsruntime/qv4internalclass.cpp | |
| parent | e3adfe617511f6a6284674108816badabd0ffecf (diff) | |
QML Debugger: Don't crash when looking up values from imported modules
We cannot look up the imports from other modules because those are
stored in the CU. But we can avoid the crash.
Pick-to: 6.6 6.5 6.2 5.15
Fixes: QTBUG-117479
Change-Id: Ib5660c94dfb7ed20baedf7f71b2f175e6be042b1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4internalclass.cpp')
| -rw-r--r-- | src/qml/jsruntime/qv4internalclass.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4internalclass.cpp b/src/qml/jsruntime/qv4internalclass.cpp index c72effd406..bf19b806e4 100644 --- a/src/qml/jsruntime/qv4internalclass.cpp +++ b/src/qml/jsruntime/qv4internalclass.cpp @@ -280,9 +280,15 @@ void InternalClass::destroy() Base::destroy(); } -QString InternalClass::keyAt(uint index) const -{ - return nameMap.at(index).toQString(); +ReturnedValue InternalClass::keyAt(uint index) const +{ + PropertyKey key = nameMap.at(index); + if (!key.isValid()) + return Encode::undefined(); + if (key.isArrayIndex()) + return Encode(key.asArrayIndex()); + Q_ASSERT(key.isStringOrSymbol()); + return key.asStringOrSymbol()->asReturnedValue(); } void InternalClass::changeMember(QV4::Object *object, PropertyKey id, PropertyAttributes data, InternalClassEntry *entry) |
