Check for null in OnPartJointBreak#707
Open
MacGyverNL wants to merge 1 commit intojrossignol:masterfrom
Open
Conversation
In the VAB, for some reason probably related to automatic autostrutting,
ContractConfigurator starts throwing NullReferenceExceptions of the type
```
[EXC 23:10:42.742] NullReferenceException: Object reference not set to an instance of an object
ContractConfigurator.Parameters.VesselNotDestroyed.OnPartJointBreak (PartJoint p, System.Single breakForce) (at <ef0243a06f2841fe9bf57034a334902e>:0)
EventData`2[T,U].Fire (T data0, U data1) (at <dc0e5f458c0f4571ad839b9c4153f347>:0)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
EventData`2:Fire(PartJoint, Single)
PartJoint:DestroyJoint()
Part:ReleaseAutoStruts()
Part:onDetach(Boolean)
Part:onDetach(Boolean)
EditorLogic:detachPart(Part)
EditorLogic:<SetupFSM>b__190_21()
KerbalFSM:RunEvent(KFSMEvent)
KerbalFSM:updateFSM(KFSMUpdateMode)
KerbalFSM:UpdateFSM()
EditorLogic:Update()
```
Because for some reason OnPartJointBreak gets called on a `PartJoint p`
for which `p.Parent.vessel` returns null.
This is reproducible on my config with normal decouplers, but the most
reliable way of reproducing it I've found is:
0. Start a new vehicle in the VAB.
1. Select a Mk1-3 command pod as the root.
2. Put an engine plate (SquadExpansion) on the bottom.
3. Put an engine on the engine plate.
4. "Pick up" the engine plate.
5. Observe the VAB stutter while the log gets filled with these
exceptions.
This happens on an old save file which I've been coaxing into working
with the current install, but I *have* done a complete reinstall of all
my mods and it happens on a *new* craft, not just existing ones. I have
not tested it in a clean save file because I figure the fix is worth
doing anyway.
|
I mean, of course the vessel of a part in the editor is gonna be null? Presumably it's a base KSP bug that the joint is even created in the editor at all, though. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the VAB, for some reason probably related to automatic autostrutting,
ContractConfigurator starts throwing NullReferenceExceptions of the type
Because for some reason OnPartJointBreak gets called on a
PartJoint pfor which
p.Parent.vesselreturns null.This is reproducible on my config with normal decouplers, but the most
reliable way of reproducing it I've found is:
exceptions.
This happens on an old save file which I've been coaxing into working
with the current install, but I have done a complete reinstall of all
my mods and it happens on a new craft, not just existing ones. I have
not tested it in a clean save file because I figure the fix is worth
doing anyway.