Principia icon indicating copy to clipboard operation
Principia copied to clipboard

The orbit analyser sometimes throws DivideByZeroException

Open eggrobin opened this issue 4 years ago • 0 comments

Reported by @al2me6 with the stack and screenshot below. There are a number of floating-point divisions cast to int, but those wouldn’t throw that exception. The only integer division in RenderWindow seems to be the following one. https://github.com/mockingbirdnest/Principia/blob/52c10f93e6d0e3a67d1903dcc26a19044b8c757d/ksp_plugin_adapter/orbit_analyser.cs#L256-L260

[EXC 14:49:33.135] DivideByZeroException: Attempted to divide by zero.
    principia.ksp_plugin_adapter.OrbitAnalyser.RenderWindow (System.Int32 window_id) (at <65c7bf2f4e324461b01170ebbad8bf3b>:0)
    principia.ksp_plugin_adapter.BaseWindowRenderer.RenderWindowAndRecordTooltip (System.Int32 window_id) (at <65c7bf2f4e324461b01170ebbad8bf3b>:0)
    UnityEngine.GUILayout+LayoutedWindow.DoWindow (System.Int32 windowID) (at <fa6f9762ac624af092525d37c9d516c4>:0)
    UnityEngine.GUI.CallWindowDelegate (UnityEngine.GUI+WindowFunction func, System.Int32 id, System.Int32 instanceID, UnityEngine.GUISkin _skin, System.Int32 forceRect, System.Single width, System.Single height, UnityEngine.GUIStyle style) (at <fa6f9762ac624af092525d37c9d516c4>:0)
    UnityEngine.DebugLogHandler:LogException(Exception, Object)
    ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
    UnityEngine.Debug:CallOverridenDebugHandler(Exception, Object)

eggrobin avatar Jan 03 '22 00:01 eggrobin