Skip to content

Commit

Permalink
fix exception when fallbackTexture is empty (#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
Morilli authored Jul 5, 2023
1 parent 8a3acbc commit 6b6d5ee
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Obsidian/Utils/SkinnedMeshUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,12 @@ private static async Task<string> 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<StaticMaterialDef>(
metaEnvironment,
Expand Down

0 comments on commit 6b6d5ee

Please sign in to comment.