magico13 / StageRecovery

NOTE Now maintained at https://github.com/linuxgurugamer/StageRecovery An addon for Kerbal Space Program that recovers funds from spent stages.
28 stars 18 forks source link

NRE when jettisoned stage gets unloaded #44

Open Li0n-0 opened 7 years ago

Li0n-0 commented 7 years ago

A null reference exception is thrown when a stage is unloaded :

NullReferenceException at (wrapper managed-to-native) UnityEngine.Transform:INTERNAL_CALL_InverseTransformDirection (UnityEngine.Transform,UnityEngine.Vector3&,UnityEngine.Vector3&) at UnityEngine.Transform.InverseTransformDirection (Vector3 direction) [0x00000] in <filename unknown>:0 at StageRecovery.RecoveryItem.DetermineTerminalVelocity () [0x00000] in <filename unknown>:0 UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object) UnityEngine.DebugLogHandler:LogException(Exception, Object) UnityEngine.Logger:LogException(Exception, Object) UnityEngine.Debug:LogException(Exception) StageRecovery.RecoveryItem:DetermineTerminalVelocity() StageRecovery.RecoveryItem:Process() StageRecovery.StageRecovery:VesselDestroyEvent(Vessel) EventData``1:Fire(Vessel) Vessel:Die() Vessel:CheckKill() VesselPrecalculate:MainPhysics(Boolean) VesselPrecalculate:FixedUpdate()

It seems to happen every time, don't matter if the stage is recoverable or not. Happen with stock chute and the one from RealChute.

More info on the KSP forum here and there.

magico13 commented 7 years ago

It's expected and handled. I haven't found a way of avoiding it other than catch and handle, but I'm still logging it to track it. If it doesn't throw then that's nice and we can use actual data, otherwise SR has to assume the direction is "down". I'll probably either stop logging it or just always assume a direction since for unloaded stages it always throws (in the editor it doesn't)

On Dec 31, 2016 11:31, "Li0n-0" notifications@github.com wrote:

A null reference exception is thrown when a stage is unloaded :

NullReferenceException at (wrapper managed-to-native) UnityEngine.Transform:INTERNAL_CALL_InverseTransformDirection (UnityEngine.Transform,UnityEngine.Vector3&,UnityEngine.Vector3&) at UnityEngine.Transform.InverseTransformDirection (Vector3 direction) [0x00000] in :0 at StageRecovery.RecoveryItem.DetermineTerminalVelocity () [0x00000] in :0 UnityEngine.DebugLogHandler: Internal_LogException(Exception, Object) UnityEngine.DebugLogHandler:LogException(Exception, Object) UnityEngine.Logger:LogException(Exception, Object) UnityEngine.Debug:LogException(Exception) StageRecovery.RecoveryItem:DetermineTerminalVelocity() StageRecovery.RecoveryItem:Process() StageRecovery.StageRecovery:VesselDestroyEvent(Vessel) EventData``1:Fire(Vessel) Vessel:Die() Vessel:CheckKill() VesselPrecalculate:MainPhysics(Boolean) VesselPrecalculate:FixedUpdate()

It seems to happen every time, don't matter if the stage is recoverable or not. Happen with stock chute and the one from RealChute.

More info on the KSP forum here http://forum.kerbalspaceprogram.com/index.php?/topic/78226-12-stagerecovery-recover-funds-from-dropped-stages-v165-102016/&do=findComment&comment=2867338 and there http://forum.kerbalspaceprogram.com/index.php?/topic/78226-12-stagerecovery-recover-funds-from-dropped-stages-v165-102016/&do=findComment&comment=2906169 .

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/magico13/StageRecovery/issues/44, or mute the thread https://github.com/notifications/unsubscribe-auth/AFC21YiSly6DnNmGT94GclFMZg79cLgeks5rNoNegaJpZM4LYlTc .