Skip to content

Commit

Permalink
Prevent creation of TabStorageWrapper when storage is a thing/comp wi…
Browse files Browse the repository at this point in the history
…th null map (#293)

I'm unsure how this exactly happens, but it's happening consistently with Save our Ship 2 torpedoes.

I assumed it'd be better to patch it here instead of doing harmony prefixes to prevent it from being created, as it's (in my eyes) much cleaner solution to this issue. And in case it ever would appear in another mod, it'll help with those situations too.
  • Loading branch information
SokyranTheDragon authored Apr 6, 2022
1 parent 6a888f9 commit b8f8189
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Source/Client/Syncing/Game/SyncGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,13 @@ public static class SyncMarkers

#region ThingFilter Markers
[MpPrefix(typeof(ITab_Storage), "FillTab")]
static void TabStorageFillTab_Prefix(ITab_Storage __instance) =>
static void TabStorageFillTab_Prefix(ITab_Storage __instance)
{
var selThing = __instance.SelStoreSettingsParent;
if (selThing is Thing {Map: null} or ThingComp {parent: {Map: null}})
return;
tabStorage = new(__instance.SelStoreSettingsParent);
}

[MpPostfix(typeof(ITab_Storage), "FillTab")]
static void TabStorageFillTab_Postfix() => tabStorage = null;
Expand Down

0 comments on commit b8f8189

Please sign in to comment.