BruceOfTheBow / BruceComfyMods

Player mods made for Comfy Valheim
GNU General Public License v3.0
1 stars 3 forks source link

hygge: fix NRE occurring if selected piece is not available #21

Closed nbusseneau closed 1 week ago

nbusseneau commented 1 week ago

If a piece was previously selected but is not available anymore for any reason, it will be null when passed down to Hud.SetupPieceInfo.

This could for example happen if using Azumatt-SearchableBuildMenu to filter build pieces after having selected a piece: if the piece is not available in the filtered list, then Hygge would spam the log with NullReferenceException.

nbusseneau commented 1 week ago

Ah funnily enough #20 that just got submitted a few hours ago is addressing the same thing. I think the approach here is a tad better though because it goes through with the default call ComfortPanelManager.ToggleOff(); as I think is expected, rather than returning early as in #20 😄