KSP-RO / TestFlight

KSP Mod that provides a part research and reliability system
42 stars 31 forks source link

NullRef from TestFlightManager.VesselDestroyed #241

Closed siimav closed 2 years ago

siimav commented 2 years ago

Found a bunch of these from ZombieZilla's log:

[LOG 17:15:35.859] [HighLogic]: =========================== Scene Change : From FLIGHT to SPACECENTER (Async) =====================
[ERR 17:15:37.365] Exception handling event onVesselDestroy in class TestFlightManager:System.NullReferenceException: Object reference not set to an instance of an object
  at TestFlightCore.TestFlightManager.Log (System.String message) [0x00005] in <f0ef12cd5df94c86a94dea2a112995d3>:0 
  at TestFlightCore.TestFlightManager.VesselDestroyed (Vessel vessel) [0x00011] in <f0ef12cd5df94c86a94dea2a112995d3>:0 
  at EventData`1[T].Fire (T data) [0x000b0] in <cd473063d3a2482f8d93d388d0c95035>:0 

[EXC 17:15:37.366] NullReferenceException: Object reference not set to an instance of an object
    TestFlightCore.TestFlightManager.Log (System.String message) (at <f0ef12cd5df94c86a94dea2a112995d3>:0)
    TestFlightCore.TestFlightManager.VesselDestroyed (Vessel vessel) (at <f0ef12cd5df94c86a94dea2a112995d3>:0)
    EventData`1[T].Fire (T data) (at <cd473063d3a2482f8d93d388d0c95035>:0)
    UnityEngine.DebugLogHandler:LogException(Exception, Object)
    ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
    UnityEngine.Debug:LogException(Exception)
    EventData`1:Fire(Vessel)
    Vessel:OnDestroy()

Looks like vessel is null in some cases? https://github.com/KSP-RO/TestFlight/blob/67651aba72382b33eca4e4261f8065e736f35d9f/TestFlightCore/TestFlightCore/TestFlight.cs#L273-L277

al2me6 commented 2 years ago

Should be fixed by https://github.com/KSP-RO/TestFlight/commit/98a238f2cf1ea8588b8cd806596a752a72190e3c.