mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:43:50 +02:00
Use default texs for empty json
This commit is contained in:
parent
984bacdae3
commit
377a20e983
1 changed files with 7 additions and 0 deletions
|
@ -116,11 +116,18 @@ QVariantMap RenderableModelEntityItem::parseTexturesToMap(QString textures) {
|
|||
|
||||
QJsonParseError error;
|
||||
QJsonDocument texturesJson = QJsonDocument::fromJson(textures.toUtf8(), &error);
|
||||
// If textures are invalid, revert to original textures
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qCWarning(entitiesrenderer) << "Could not evaluate textures property value:" << textures;
|
||||
return _originalTextures;
|
||||
}
|
||||
|
||||
QVariantMap texturesMap = texturesJson.toVariant().toMap();
|
||||
// If textures are unset, revert to original textures
|
||||
if (texturesMap.isEmpty()) {
|
||||
return _originalTextures;
|
||||
}
|
||||
|
||||
return texturesJson.toVariant().toMap();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue