FirstPersonKSP / FreeIva

Work in progress mod for Kerbal Space Program which allows getting out of your seat and moving around the vessel while on IVA.
GNU General Public License v2.0
25 stars 8 forks source link

Exception spew in SetCameraIVA & PostBoardCoroutine #355

Closed JonnyOThan closed 10 months ago

JonnyOThan commented 10 months ago
[EXC 01:44:32.585] NullReferenceException: Object reference not set to an instance of an object
    CameraManager.SetCameraIVA (Kerbal kerbal, System.Boolean resetCamera) (at <4b449f2841f84227adfaad3149c8fdba>:0)
    FreeIva.FreeIva+<PostBoardCoroutine>d__10.MoveNext () (at <3475bb070fd443a49de5f884511dbd48>:0)
    UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <12e76cd50cc64cf19e759e981cb725af>:0)
    UnityEngine.DebugLogHandler:LogException(Exception, Object)
    ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
    UnityEngine.Debug:CallOverridenDebugHandler(Exception, Object)
[LOG 01:44:32.842] [KSP-Recall.StealBackMyFunds] WARNING: Your refunding for kerbolea-reactor-25:FFAFAFC4 was squashed by `IPartCostModifier` and was mangled to prevent losses ( see https://github.com/net-lisias-ksp/KSP-Recall/issues/60 ). Ideal value:694056.422762175420 ; hack used instead:694056.5
[EXC 01:44:38.469] NullReferenceException: Object reference not set to an instance of an object
    CameraManager.SetCameraIVA (Kerbal kerbal, System.Boolean resetCamera) (at <4b449f2841f84227adfaad3149c8fdba>:0)
    KSP.UI.Screens.Flight.KerbalPortrait.ClickIVA () (at <4b449f2841f84227adfaad3149c8fdba>:0)
    UnityEngine.Events.InvokableCall.Invoke () (at <12e76cd50cc64cf19e759e981cb725af>:0)
    UnityEngine.Events.UnityEvent.Invoke () (at <12e76cd50cc64cf19e759e981cb725af>:0)
    UnityEngine.UI.Button.Press () (at <0c883c16262a4198973f823d01e07427>:0)
    UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at <0c883c16262a4198973f823d01e07427>:0)
    UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at <0c883c16262a4198973f823d01e07427>:0)
    UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at <0c883c16262a4198973f823d01e07427>:0)
    UnityEngine.DebugLogHandler:LogException(Exception, Object)
    ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
    UnityEngine.EventSystems.EventSystem:Update()
[EXC 01:44:39.527] NullReferenceException: Object reference not set to an instance of an object
    CameraManager.SetCameraIVA (Kerbal kerbal, System.Boolean resetCamera) (at <4b449f2841f84227adfaad3149c8fdba>:0)
    CameraManager.SetCameraIVA () (at <4b449f2841f84227adfaad3149c8fdba>:0)
    CameraManager.NextCameraMode () (at <4b449f2841f84227adfaad3149c8fdba>:0)
    CameraManager.Update () (at <4b449f2841f84227adfaad3149c8fdba>:0)
    UnityEngine.DebugLogHandler:LogException(Exception, Object)
    ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
    UnityEngine.Debug:CallOverridenDebugHandler(Exception, Object)
[EXC 01:44:39.915] NullReferenceException: Object reference not set to an instance of an object
    CameraManager.SetCameraIVA (Kerbal kerbal, System.Boolean resetCamera) (at <4b449f2841f84227adfaad3149c8fdba>:0)
    CameraManager.SetCameraIVA () (at <4b449f2841f84227adfaad3149c8fdba>:0)
    CameraManager.NextCameraMode () (at <4b449f2841f84227adfaad3149c8fdba>:0)
    CameraManager.Update () (at <4b449f2841f84227adfaad3149c8fdba>:0)
    UnityEngine.DebugLogHandler:LogException(Exception, Object)
    ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
    UnityEngine.Debug:CallOverridenDebugHandler(Exception, Object)
[EXC 01:44:40.098] NullReferenceException: Object reference not set to an instance of an object
    CameraManager.SetCameraIVA (Kerbal kerbal, System.Boolean resetCamera) (at <4b449f2841f84227adfaad3149c8fdba>:0)
    CameraManager.SetCameraIVA () (at <4b449f2841f84227adfaad3149c8fdba>:0)
    CameraManager.NextCameraMode () (at <4b449f2841f84227adfaad3149c8fdba>:0)
    CameraManager.Update () (at <4b449f2841f84227adfaad3149c8fdba>:0)
    UnityEngine.DebugLogHandler:LogException(Exception, Object)
    ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
    UnityEngine.Debug:CallOverridenDebugHandler(Exception, Object)

KSP - 2023-11-14T084904.662.log

This could be related to #354:

[WRN 01:44:32.295] InternalModel error: Part Crew capacity is 10, but 0 seats are defined in internal model
[ERR 01:44:32.295] [FreeIva] Could not find a centrifuge module in INTERNAL 'sspx-expandable-centrifuge-375-2-iva' for PART 'sspx-expandable-centrifuge-375-2'

If there were no seats because the internal model was destroyed, this could probably happen...but it might also happen when boarding a part that has more crew capacity than internal seats. But the PostBoardCoroutine wouldn't have been started if the kerbal didn't have an internal seat assigned. But maybe if the portrait gallery was full, the internal model wouldn't have been created?

JonnyOThan commented 10 months ago

Gonna mark this fixed, but I'm not confident. Will reopen if it pops up again.

JonnyOThan commented 10 months ago

Seems like this was likely caused by #356 - when the internalcamera is destroyed, trying to activate IVA mode will spew these exceptions.

This will still occur if some other bug destroys the internacamera, as in https://github.com/KSP-KOS/KOS/issues/3095