From a452f14fd9b20b429048fc28aeac0c0542484a50 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 29 Apr 2019 11:48:10 +0200 Subject: 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 --- src/qml/compiler/qqmlpropertycachecreator_p.h | 5 +++-- 1 file 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::property QVarLengthArray 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(); -- cgit v1.2.3