QmlJS: Fix crash

Fixes: QTCREATORBUG-26151
Change-Id: Ibfc2a17f0eb8eb7c4804045dba9a1963249ba860
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
This commit is contained in:
Christian Stenger
2021-08-24 13:31:53 +02:00
parent 680daaadb7
commit 13be5e7eb4

View File

@@ -158,11 +158,13 @@ ObjectValue *Bind::bindObject(UiQualifiedId *qualifiedTypeNameId, UiObjectInitia
_rootObjectValue = objectValue;
_inlineComponents[_currentComponentName] = objectValue;
if (!_currentComponentName.isEmpty()) {
if (_currentComponentName.contains('.'))
if (_currentComponentName.contains('.')) {
parentComponentName = _currentComponentName.mid(0,_currentComponentName.lastIndexOf('.'));
else
parentComponentName = "";
nextRoot = _inlineComponents.value(parentComponentName);
} else {
parentComponentName = "";
nextRoot = _rootObjectValue;
}
// we add the inline component inside its parent
nextRoot->setMember(_currentComponentName.mid(_currentComponentName.lastIndexOf('.') + 1), objectValue);
_rootObjectValue->setClassName(_doc->componentName() + "." + _currentComponentName); // use :: instead of .?