KiameV / rimworld-weaponstorage

Storage for weapons and the ability to quickly equip weaponry.
MIT License
1 stars 1 forks source link

Check game state before executing scribe prefix #3

Closed FluffierThanThou closed 5 years ago

FluffierThanThou commented 5 years ago

In https://github.com/KiameV/rimworld-weaponstorage/blob/master/Source/HarmonyPatches.cs#L537 you're running a prefix on ScribeSaver.InitSaving. This prefix fails when the WeaponStoragesToUse list in WorldComp is populated, but the map for these storages is null. My guess is after closing a game and returning to the main menu, the WeaponStoragesToUse list is not cleared. That's causing some issues in other scribe calls, and a potential memory leak.

Please either;

FluffierThanThou commented 5 years ago

https://pastebin.com/LWUQ3e5k

KiameV commented 5 years ago

Thanks. Added code to help prevent this.