AlternateResourcePanel icon indicating copy to clipboard operation
AlternateResourcePanel copied to clipboard

Exception during scene switch when Replace stock is set and ARP window is open

Open jarosm opened this issue 7 years ago • 1 comments

This line in KSPAlternateResourcePanel:SetAppButtonToTrue() throws null ref exception during scene switch (into flight scene) when ARP is set to replace stock panel and ARP window was open prior scene switch, because ResourceDisplay.Instance is null.

ButtonToToggle = ResourceDisplay.Instance.appLauncherButton;

The exception isn't thrown if ARP panel was closed when leaving flight scene. The exception is thrown only when switching into flight scene. There is no visible impact on ARP function.

I can add logs if you want.

jarosm avatar Oct 23 '17 21:10 jarosm

Hi. It's been a while, but I just came back to KSP and noticed this still haven't been fixed.

For the NRE it can be fixed by changing

ButtonToToggle = ResourceDisplay.Instance.appLauncherButton;

to

ButtonToToggle = ResourceDisplay.Instance?.appLauncherButton;

Unfortunately it doesn't fix the issue of the window being stuck on screen until you click the icon to close and then reopen it. Seems like that's a separate issue from this.

UltraJohn avatar Apr 07 '23 22:04 UltraJohn