summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAurélien Brooke <aurelien@bahiasoft.fr>2023-06-14 07:43:59 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-07-21 12:18:23 +0000
commit23b9f4012b1f8b4b0477be38519c83657e78a15b (patch)
tree7bc9cedd235c032cd066d65d0fa84a94367cfa60
parentd9477654e7b2f11161e7d34a6e4835653f628aa4 (diff)
GLTFImporter: fix crash when no material matches
Don't call renameFromJson(jsonObj, mat) with a nullptr mat. Fixes: QTBUG-100386 Change-Id: Ib35cd34212db6a309f629eabc93c19a69957eaf7 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit 670144a660823238ca286d5b631c9e1ae7dd8f00) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/plugins/sceneparsers/gltf/gltfimporter.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/sceneparsers/gltf/gltfimporter.cpp b/src/plugins/sceneparsers/gltf/gltfimporter.cpp
index 93896afdc..0ccf4dc10 100644
--- a/src/plugins/sceneparsers/gltf/gltfimporter.cpp
+++ b/src/plugins/sceneparsers/gltf/gltfimporter.cpp
@@ -1050,9 +1050,9 @@ QMaterial *GLTFImporter::commonMaterial(const QJsonObject &jsonObj)
} else {
for (QVariantHash::const_iterator it = params.constBegin(), itEnd = params.constEnd(); it != itEnd; ++it)
mat->setProperty(it.key().toUtf8(), it.value());
- }
- renameFromJson(jsonObj, mat);
+ renameFromJson(jsonObj, mat);
+ }
return mat;
}