From 6b6d5eed68b4a6b2ed56200827dc5873d66b49ed Mon Sep 17 00:00:00 2001 From: Moritz Bender <35152647+Morilli@users.noreply.github.com> Date: Wed, 5 Jul 2023 11:51:49 +0200 Subject: [PATCH] fix exception when fallbackTexture is empty (#201) --- Obsidian/Utils/SkinnedMeshUtils.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Obsidian/Utils/SkinnedMeshUtils.cs b/Obsidian/Utils/SkinnedMeshUtils.cs index a0fc363..e9c1efc 100644 --- a/Obsidian/Utils/SkinnedMeshUtils.cs +++ b/Obsidian/Utils/SkinnedMeshUtils.cs @@ -79,8 +79,12 @@ private static async Task CreateMaterialTextureImageBlob( IJSRuntime js ) { BinTreeObject materialDefObject = skinPackage.Objects.GetValueOrDefault(materialLink); - if (materialDefObject is null) - return await ImageUtils.CreateImageBlobFromChunk(js, fallbackTexture, wad); + if (materialDefObject is null) { + return string.IsNullOrEmpty(fallbackTexture) switch { + true => fallbackTexture, + _ => await ImageUtils.CreateImageBlobFromChunk(js, fallbackTexture, wad) + }; + } var materialDef = MetaSerializer.Deserialize( metaEnvironment,