Skip to content

Stop blocking map view part clicks before there is a camera - #427

Open
djungelorm wants to merge 1 commit into
KSPModdingLibs:masterfrom
djungelorm:block-map-view-part-click-nre
Open

Stop blocking map view part clicks before there is a camera#427
djungelorm wants to merge 1 commit into
KSPModdingLibs:masterfrom
djungelorm:block-map-view-part-click-nre

Conversation

@djungelorm

Copy link
Copy Markdown

Part_UpdateMouseOver_Prefix reads CameraManager.Instance.currentCameraMode as soon as HighLogic.LoadedSceneIsFlight is true. The scene calls itself flight from the moment it starts loading, a good while before the camera manager exists, so every frame of a load into flight throws an NRE.

Returning true when the camera manager is missing, so that stock runs as it would unpatched, only moves the exception: stock Part.UpdateMouseOver reads the same field just as unguarded, and the NREs still occur.

We can safely skip the method (returning false) until there is a camera manager. Nothing can be moused over before then, and stock threw straight back out of the method at that point anyway. This change maintains the existing behaviour, without the NREs polluting the game log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant