Merge pull request #1254 from ousttrue/fix10/thumbnail_null_check

[1.0] Thumbnail の nullcheck
This commit is contained in:
ousttrue
2021-09-28 20:13:18 +09:00
committed by GitHub

View File

@@ -81,8 +81,19 @@ namespace UniVRM10
value = default;
return false;
}
var thumbnailImage = vrm.Meta.ThumbnailImage;
if (!thumbnailImage.HasValue)
{
value = default;
return false;
}
var imageIndex = thumbnailImage.Value;
if (imageIndex < 0 || imageIndex >= data.GLTF.images.Count)
{
value = default;
return false;
}
var imageIndex = vrm.Meta.ThumbnailImage.Value;
var gltfImage = data.GLTF.images[imageIndex];
// data.GLTF.textures は前処理によりユニーク性がある