New Patch: Fix Planetarium.GetUniversalTime() in editor
NathanKell opened this issue · 2 comments
GetUniversalTime is supposed to detect when it's invalid and return HighLogic.CurrentGame.UniversalTime
but at some point Planetarium started running in the editor which means its check for fetch == null
returns false, so it still tries to get UT from its instance. But the instance has the UT from before the last revert, rather than from the current game.
Fix: Make the check fetch == null || HighLogic.LoadedSceneIsEditor
. RP-1 has used this check for a long time (with its own wrapper for GetUniversalTime) and it's been fine, but there's plenty of code--including stock code--that assumes GetUniversalTime is correct.
Brought to my attention by KSP-RO/RP-1#2067 (because StrategySystem's Update runs in the editor, because of course it does).
Update: Gonna ship this patch in RP-1 and let it bake for a week or two before making it in KSPCF. @gotmachine can do it as a transpiler when he has time, I'm just gonna prefix.
Fixed in e756eb2