From 2d0c886a49d8c7fb649eba8f20a4d20eb98c6349 Mon Sep 17 00:00:00 2001 From: Neko Boi Nick <950594+thakyZ@users.noreply.github.com> Date: Mon, 26 Aug 2024 09:35:45 -0700 Subject: [PATCH] Fix bug with png files that aren't valid Fixes a bug where in if a file is in the mod directory and doesn't work with an NPC, it will skip over using that file. - Update Portraiture/TextureLoader.cs --- Portraiture/TextureLoader.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Portraiture/TextureLoader.cs b/Portraiture/TextureLoader.cs index a1eb39db..51fa74b7 100644 --- a/Portraiture/TextureLoader.cs +++ b/Portraiture/TextureLoader.cs @@ -222,8 +222,11 @@ private static void loadAllPortraits() ScaledTexture2D scaled; - - scaled = ScaledTexture2D.FromTexture(Game1.getCharacterFromName(name).Portrait, texture, scale); + + var npc = Game1.getCharacterFromName(name); + if (npc == null) + continue; + scaled = ScaledTexture2D.FromTexture(npc.Portrait, texture, scale); if (!pTextures.ContainsKey(folderName + ">" + name)) pTextures.Add(folderName + ">" + name, scaled); @@ -379,4 +382,4 @@ public class SmapiManifest public List Dependencies { get; set; } = new List(); } -} \ No newline at end of file +}