New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NullReferenceException: Object reference not set to an instance of an object | connector port bug? #167
Comments
Please, attach full logs and provide steps to reproduce. |
this exception vanished/didnt happened again after i removed the magnet off my orbital station, im sorry i cannot provide a log anymore, this happened 2 times, then i tried to remove things off the station where it happened. sry for not beeing much helpful, but im trying to help tho EDIT 2:
EDIT 3: the connector ports are not stackable anymore .. unsure what caused it, or if it will fix it itself EDIT 4: strike out EDIT 3, that is/was caused by another mod named KRnD i cannot imagine any KSP without KIS/KAS! |
KIS shouldn't be trying to snapshot anything from its constructor. You should wait until Start() / OnStart() to run that kind of code. Otherwise you're not allowing time for initialization methods on other MonoBehavior objects to execute. Including other mod's PartModules. It's no wonder you've got compatibility issues with other mods. (for which blame is wrongly being assigned to every other mod with which KIS is incompatible) Define either Start/OnStart method and do your snapshotting there. (as well as any other KIS initialization which might depend on other mods having initialized on the part) |
What code exactly you're talking about? The stack trace above clearly shows that snapshot was attempted by the KSP core ( |
Yes you're right. I had just come here from looking at your code for KIS_Item and I was preoccupied with what I found there and I didn't pay enough attention to what was presented in this issue, so what I said isn't valid to this instance, sorry. But what I said is still valid for the cases where you're trying to snapshot before any Unity or Mono methods have been called and you should give serious thought to moving that code to where it's getting called after other PartModule's classes have had chance to initialize. |
im happy about hearing you guys talking about this bunch of issue bundle (?) .. im sorry when it does not clearly conform to other issue-reports but i just try to give you guys something so you can work with that to improve the mod/add-on regards :) |
The whole approach with part snapshots has proven to be error prone. E.g. this bug demonstrates an issue with a part that was properly created and initalized. Alas, it's not possible to get rid of it without major refactoring of KIS. I plan to do it but it's a long term effort. For now the only feasible approach is making patches for the spotted problems (e.g. this one once I'm able to reproduce it). |
@LouisCyfer Hey, are you able to reliably reproduce the issue? Can you try removing all the non-part mods (i.e. mods that modify behavior of the existing parts) and check if the error still exists? As far as I can tell from the logs there is a mod that adds a badly initialized module to a part. Snapshot methods cannot handle nulls in the config/persistent fields, and this module seems to have a null there. |
i can try that, reporting back once ive done .. going to assume its KRnD (if not one of the other parts) .. cuz when i uninstalled that one it reverted and the parts worked as intended .. i'll update soon! EDIT: right after i uninstalled KRnD 1.8 (basicly deleted the folder in /GameData) i had alittle bit of resort the inventory but everything seemed fine again hope this helps tho .. just for the record, im not trying to disregard or blame any mods or stuff .. im fan of every creative work that is been done to KSP at all, its a massive efford, time consumption and lots of unpaid work tho. |
I'm not taking it as a blame :) And I'm really appreciated you've spend your time to gather all these details. Now I'm confident it's KRnD that makes the problem. I'll take a look if it can be worked around. |
TBD: Before decoupling parts do a prefabs clean up. It looks like some mods update prefabs after the KIS config stage (which normally does the cleanup). |
im glad i could be any helpful, and yes i know KRnD is officially supported for KSP 1.1.2 but it should still work im looking forward for the next update! tyvm! |
@LouisCyfer Is this bug still happening in 1.2? |
hiyas, I assume you mean KSP 1.2+ and no I did not see this occouring anymore, this one seems solved and I'm closing this. Ty for your updates :) |
hi, this is what my log spits out .. it seems to crash my game (at least thats the last exception in my logs
exception.txt
226.1066: NullReferenceException: Object reference not set to an instance of an object at KIS.ModuleKISInventory.GuiHandleUsedSlot (Rect textureRect, Int32 slotIndex) at KIS.ModuleKISInventory.GuiInventory () at KIS.ModuleKISInventory.GuiMain (Int32 windowID) at UnityEngine.GUILayout+LayoutedWindow.DoWindow (Int32 windowID) at UnityEngine.GUI.CallWindowDelegate (UnityEngine.WindowFunction func, Int32 id, UnityEngine.GUISkin _skin, Int32 forceRect, Single width, Single height, UnityEngine.GUIStyle style)
The text was updated successfully, but these errors were encountered: