Skip to content

Exception in OrbitDriver.Start → Orbit.Init on toolbar button click #2

@HebaruSan

Description

@HebaruSan

Background

PlanningNode version: 0.1.2

KSP version: 1.11

Problem

When you click the toolbar button, the mod works, but an exception is thrown, visible on screen and in the log:

[EXC 15:54:20.691] NullReferenceException: Object reference not set to an instance of an object
	Orbit.Init () (at <2afc64dea36946459d4707808bdac511>:0)
	OrbitDriver.Start () (at <2afc64dea36946459d4707808bdac511>:0)

Cause

I think this happens because the Orbit, a default object created by OrbitDriver at its own initialization, doesn't have a reference to a CelestialBody.

However, if I fix that by setting the OrbitDriver's orbit to our real orbit, then something worse happens:

[OrbitDriver Warning!]: DUMMY had a NaN Orbit and was removed.

Or:

[F: 1234567]: Vessel DUMMY crashed through terrain on Kerbin.

After either of these errors, our dummy Vessel is deleted, and our ProtoVessel, Orbit, OrbitDriver, OrbitTargeter, PatchedConicsSolver, PatchedConicsRenderer, and even our toolbar button are deleted along with it. In other words, the mod disappears completely immediately upon clicking the button. The cascading deletes are probably due to sharing GameObjects at whatever level, but I am not confident that having part of the structure deleted would be any more recoverable. Some kind of more advanced Unity magic may be needed here to work around this.

In the meantime, this exception doesn't stop anything from working, so it should be safe to ignore.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions