LeFauxMatt / StardewMods

Stardew Valley mods
MIT License
23 stars 38 forks source link

Toolbat Icons: NullReference when calling GetApi #83

Open Becks723 opened 7 months ago

Becks723 commented 7 months ago

Hello, someone had reported an error to me. When trying to getapi from Toolbar Icons, it says NullReferenceException. (https://smapi.io/log/61ce5105734041a8aa4da78555d0df7d)

Failed loading the per-mod API instance from Toolbar Icons. Integrations with other mods may not work. 
Error: NullReferenceException: Object reference not set to an instance of an object. 
at StardewMods.ToolbarIcons.ModEntry.GetApi(IModInfo mod) in X:\Repos\stardew-mods\ToolbarIcons\ModEntry.cs:line 33 
at StardewModdingAPI.Framework.ModHelpers.ModRegistryHelper.GetApi(String uniqueID) in SMAPI\Framework\ModHelpers\ModRegistryHelper.cs:line 88

I assume it's the container object not been initialized yet when my mod firstly reached OnGameLaunched. So I think container needs to be inited early in the Entry part, rather than OnGameLaunched.