daviscook477 / ONI-Mods

Mods for Oxygen Not Included
7 stars 31 forks source link

Fix NPE in TeleStoragePatches Postfix #2

Closed TZer0 closed 4 years ago

TZer0 commented 4 years ago

Seems to happen in rare cases when a selected tile is excavated/destroyed.

Probably fixes #1

kcwebby commented 4 years ago

@TZer0 Don't suppose you'd shared the compiled DLL for me to play with?

TZer0 commented 4 years ago

@kcwebby if I shared it, you'd have to copy things around manually (the mod saves its own data in the mod folder) and I'm not entirely sure how Steam deals with the situation of me giving you a non-workshop file if you put it in the default location.

If you get the error, it is basically safe to ignore as far as I can tell (albeit somewhat annoying)

ghost commented 4 years ago

Hey, i don't really know where to post this, took me a longer than it should have to find this thread, but i encountered an error an hour ago and thought i'd post it here, judging by the report... it's something about the info screen???

NullReferenceException: Object reference not set to an instance of an object at TeleStorage.TeleStoragePatches+SimpleInfoScreen_RefreshStorage_Patch.Postfix (SimpleInfoScreen instance, UnityEngine.GameObject __storagePanel, UnityEngine.GameObject selectedTarget, System.Collections.Generic.Dictionary2[System.String,UnityEngine.GameObject]& _storageLabels) [0x00001] in <2f3156c3da7e4e5cbd409ef290d3b495>:0 at (wrapper dynamic-method) SimpleInfoScreen.RefreshStorage_Patch1(object) at SimpleInfoScreen.Refresh (System.Boolean force) [0x000a3] in <1451e1c3b7a64dd1bc2ed2e3a3ee7859>:0 at SimpleInfoScreen.OnRefreshData (System.Object obj) [0x00000] in <1451e1c3b7a64dd1bc2ed2e3a3ee7859>:0 at SimpleInfoScreen+<>c.<.cctor>b60_0 (SimpleInfoScreen component, System.Object data) [0x00000] in <1451e1c3b7a64dd1bc2ed2e3a3ee7859>:0 at EventSystem+IntraObjectHandler1[ComponentType].Trigger (UnityEngine.GameObject gameObject, System.Object eventData) [0x0001e] in <5e8d06b8fe0d451c94539ae3b47c5a2e>:0 at EventSystem.Trigger (UnityEngine.GameObject go, System.Int32 hash, System.Object data) [0x0004f] in <5e8d06b8fe0d451c94539ae3b47c5a2e>:0 at KMonoBehaviour.Trigger (System.Int32 hash, System.Object data) [0x00026] in <5e8d06b8fe0d451c94539ae3b47c5a2e>:0 at DetailsScreen.OnRefreshData (System.Object obj) [0x00034] in <1451e1c3b7a64dd1bc2ed2e3a3ee7859>:0 at DetailsScreen+<>c.<.cctor>b__58_0 (DetailsScreen component, System.Object data) [0x00000] in <1451e1c3b7a64dd1bc2ed2e3a3ee7859>:0 at EventSystem+IntraObjectHandler`1[ComponentType].Trigger (UnityEngine.GameObject gameObject, System.Object eventData) [0x0001e] in <5e8d06b8fe0d451c94539ae3b47c5a2e>:0 at EventSystem.Trigger (UnityEngine.GameObject go, System.Int32 hash, System.Object data) [0x0004f] in <5e8d06b8fe0d451c94539ae3b47c5a2e>:0 at KMonoBehaviour.Trigger (System.Int32 hash, System.Object data) [0x00026] in <5e8d06b8fe0d451c94539ae3b47c5a2e>:0 at CellSelectionObject.UpdateValues () [0x000c7] in <1451e1c3b7a64dd1bc2ed2e3a3ee7859>:0 at CellSelectionObject.OnObjectSelected (System.Object o) [0x00044] in <1451e1c3b7a64dd1bc2ed2e3a3ee7859>:0 at DetailsScreen.Refresh (UnityEngine.GameObject go) [0x00024] in <1451e1c3b7a64dd1bc2ed2e3a3ee7859>:0 at RootMenu.OnSelectObject (System.Object data) [0x00086] in <1451e1c3b7a64dd1bc2ed2e3a3ee7859>:0 at EventSystem.Trigger (UnityEngine.GameObject go, System.Int32 hash, System.Object data) [0x000fe] in <5e8d06b8fe0d451c94539ae3b47c5a2e>:0 at KMonoBehaviour.Trigger (System.Int32 hash, System.Object data) [0x00026] in <5e8d06b8fe0d451c94539ae3b47c5a2e>:0 at SelectTool.Select (KSelectable new_selected, System.Boolean skipSound) [0x0012f] in <1451e1c3b7a64dd1bc2ed2e3a3ee7859>:0 at SelectTool.OnLeftClickDown (UnityEngine.Vector3 cursor_pos) [0x00039] in <1451e1c3b7a64dd1bc2ed2e3a3ee7859>:0 at PlayerController.OnKeyDown (KButtonEvent e) [0x000ac] in <1451e1c3b7a64dd1bc2ed2e3a3ee7859>:0 at KInputHandler.HandleKeyDown (KButtonEvent e) [0x0001c] in <5e8d06b8fe0d451c94539ae3b47c5a2e>:0 at KInputHandler.HandleKeyDown (KButtonEvent e) [0x0006f] in <5e8d06b8fe0d451c94539ae3b47c5a2e>:0 at KInputHandler.HandleEvent (KInputEvent e) [0x00008] in <5e8d06b8fe0d451c94539ae3b47c5a2e>:0 at KInputController.Dispatch () [0x0001c] in <5e8d06b8fe0d451c94539ae3b47c5a2e>:0 at KInputManager.Dispatch () [0x00017] in <5e8d06b8fe0d451c94539ae3b47c5a2e>:0 at KInputManager.Update () [0x0002e] in <5e8d06b8fe0d451c94539ae3b47c5a2e>:0 at GameInputManager.Update () [0x00007] in <5e8d06b8fe0d451c94539ae3b47c5a2e>:0 at Global.Update () [0x00000] in <1451e1c3b7a64dd1bc2ed2e3a3ee7859>:0

Edited 2/26/20 : Okay, so i just got the exact same crash, my game froze for a split second and i clicked on some chlorine and immediately got the error, i'm not entirely sure if this is true, but i think the mod is trying to refresh the info screen on the (chlorine, for this instance) but that particular info screen never held that information, thus resulting in the crash.

TZer0 commented 4 years ago

@HyperWilson

Yeah, uh, the author of the mod has just completely ignored this PR which fixes this problem.

And yes, the stack-trace you posted is the same bug.

ghost commented 4 years ago

What do you mean he's ignored this "PR" I'm unfamiliar with the acronym. Is the author still active at all? Also, i can absolutely confirm it happens when the game freezes for a split second while clicking on something. It happens more frequently during late game as the game lags much more with so much shit on screen.

Noticed a few other things in the logs:

NullReferenceException: Object reference not set to an instance of an object at TeleStorage.TeleStoragePatches+SimpleInfoScreen_RefreshStorage_Patch.Postfix (SimpleInfoScreen instance, UnityEngine.GameObject __storagePanel, UnityEngine.GameObject selectedTarget, System.Collections.Generic.Dictionary2[System.String,UnityEngine.GameObject]& ___storageLabels) [0x00001] in <2f3156c3da7e4e5cbd409ef290d3b495>:0 at (wrapper dynamic-method) SimpleInfoScreen.RefreshStorage_Patch1(object) at SimpleInfoScreen.Refresh (System.Boolean force) [0x000a3] in <1451e1c3b7a64dd1bc2ed2e3a3ee7859>:0 at SimpleInfoScreen.OnRefreshData (System.Object obj) [0x00000] in <1451e1c3b7a64dd1bc2ed2e3a3ee7859>:0 at SimpleInfoScreen+<>c.<.cctor>b__60_0 (SimpleInfoScreen component, System.Object data) [0x00000] in <1451e1c3b7a64dd1bc2ed2e3a3ee7859>:0 at EventSystem+IntraObjectHandler1[ComponentType].Trigger (UnityEngine.GameObject gameObject, System.Object eventData) [0x0001e] in <5e8d06b8fe0d451c94539ae3b47c5a2e>:0 at EventSystem.Trigger (UnityEngine.GameObject go, System.Int32 hash, System.Object data) [0x0004f] in <5e8d06b8fe0d451c94539ae3b47c5a2e>:0 at KMonoBehaviour.Trigger (System.Int32 hash, System.Object data) [0x00026] in <5e8d06b8fe0d451c94539ae3b47c5a2e>:0 at DetailsScreen.OnRefreshData (System.Object obj) [0x00034] in <1451e1c3b7a64dd1bc2ed2e3a3ee7859>:0 at DetailsScreen+<>c.<.cctor>b__58_0 (DetailsScreen component, System.Object data) [0x00000] in <1451e1c3b7a64dd1bc2ed2e3a3ee7859>:0 at EventSystem+IntraObjectHandler`1[ComponentType].Trigger (UnityEngine.GameObject gameObject, System.Object eventData) [0x0001e] in <5e8d06b8fe0d451c94539ae3b47c5a2e>:0 at EventSystem.Trigger (UnityEngine.GameObject go, System.Int32 hash, System.Object data) [0x0004f] in <5e8d06b8fe0d451c94539ae3b47c5a2e>:0 at KMonoBehaviour.Trigger (System.Int32 hash, System.Object data) [0x00026] in <5e8d06b8fe0d451c94539ae3b47c5a2e>:0 at CellSelectionObject.UpdateValues () [0x000c7] in <1451e1c3b7a64dd1bc2ed2e3a3ee7859>:0 at CellSelectionObject.Update () [0x00264] in <1451e1c3b7a64dd1bc2ed2e3a3ee7859>:0


NullReferenceException: Object reference not set to an instance of an object at TeleStorage.TeleStoragePatches+SimpleInfoScreen_RefreshStorage_Patch.Postfix (SimpleInfoScreen instance, UnityEngine.GameObject __storagePanel, UnityEngine.GameObject selectedTarget, System.Collections.Generic.Dictionary`2[System.String,UnityEngine.GameObject]& ___storageLabels) [0x00001] in <2f3156c3da7e4e5cbd409ef290d3b495>:0 at (wrapper dynamic-method) SimpleInfoScreen.RefreshStorage_Patch1(object) at SimpleInfoScreen.Refresh (System.Boolean force) [0x000a3] in <1451e1c3b7a64dd1bc2ed2e3a3ee7859>:0 at SimpleInfoScreen.Update () [0x00000] in <1451e1c3b7a64dd1bc2ed2e3a3ee7859>:0

^ This particular error repeats over and over in the logs roughly 12-15 times until i finally quit the game.

ghost commented 4 years ago

Ah, i see the fix you posted, any way to patch it manually if the author of the mod is too lazy?

TZer0 commented 4 years ago

@HyperWilson PR = pull request.

This is my suggestion for a change in the Author's (@daviscook477) codebase.

it'll fix the problem, but it seems that davis has just been doing other code changes and has potentially not noticed that there's a bugfix here waiting for them.

TZer0 commented 4 years ago

@HyperWilson It gets a bit more complicated.

You have to pull down the source code with my fix (and the author's changes because I've not updated my codebase) and build it yourself in visual studio. And then you need to transfer the save-data from one folder to another.

It gets messy. I just wish someone could poke the author and have them merge this pull request.

TZer0 commented 4 years ago

Thanks, @daviscook477!