aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2019-04-29 11:48:10 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2019-04-29 10:14:32 +0000
commita452f14fd9b20b429048fc28aeac0c0542484a50 (patch)
tree26492d77a90003807747ffa3b8679f98dc920372 /src/qml
parentd4239d2bf94274d849344a95f94dba65c1c22999 (diff)
Fix coverity warning
Commit bc00353cffbfe0f74b602a16452f2e7bcd588152 accidentally removed the assert that expressed how objectForId will always succeed with the alias target. That caused coverity to complain that objectAt() may be called with a negative (then array) index. Change-Id: I8651e0826c92e41ab00bf8a44f1abfd1cbfb0e06 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/compiler/qqmlpropertycachecreator_p.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/qml/compiler/qqmlpropertycachecreator_p.h b/src/qml/compiler/qqmlpropertycachecreator_p.h
index 074dc98648..901602d17b 100644
--- a/src/qml/compiler/qqmlpropertycachecreator_p.h
+++ b/src/qml/compiler/qqmlpropertycachecreator_p.h
@@ -703,8 +703,9 @@ inline QQmlCompileError QQmlPropertyCacheAliasCreator<ObjectContainer>::property
QVarLengthArray<const QV4::CompiledData::Alias *, 4> seenAliases({lastAlias});
do {
- const CompiledObject *targetObject = objectContainer->objectAt(
- objectForId(component, lastAlias->targetObjectId));
+ const int targetObjectIndex = objectForId(component, lastAlias->targetObjectId);
+ Q_ASSERT(targetObjectIndex >= 0);
+ const CompiledObject *targetObject = objectContainer->objectAt(targetObjectIndex);
Q_ASSERT(targetObject);
auto nextAlias = targetObject->aliasesBegin();