codepoetpbowden/ConnectedLivingSpace

NRE at at ConnectedLivingSpace.CLSAddon.RebuildCLSVessel

Closed this issue · 5 comments

Sometimes, when trying to load a vessel .craft file into the VAB, I get the following exception. I have not been able to figure out why it is happening.

CRFFix.Start()

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

SAFix.Start()

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

[WeldingTool] - UbioWeldingLtd.EditorToolbar => initToolbar

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

CLS highlighted parts gathering Error: System.NullReferenceException: Object reference not set to an instance of an object

at ConnectedLivingSpace.CLSAddon.RebuildCLSVessel (.Part newRootPart) [0x00000] in :0

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

Tac.LifeSupportModule[FFF84D52][214.06]: OnStart: Editor

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

Tac.TacGenericConverter[FFF84516][214.06]: OnStart: Editor

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

Tac.TacGenericConverter[FFF844F4][214.06]: OnStart: Editor

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

Tac.TacGenericConverter[FFF844D2][214.06]: OnStart: Editor

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

Tac.LifeSupportModule[FFF844BE][214.06]: OnStart: Editor

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

Tac.TacGenericConverter[FFF84482][214.06]: OnStart: Editor

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

Tac.LifeSupportModule[FFF8446E][214.06]: OnStart: Editor

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

Tac.LifeSupportModule[FFF83C02][214.06]: OnStart: Editor

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

Tac.LifeSupportModule[FFF83B8C][214.06]: OnStart: Editor

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

[MechJeb2] MechJebFARExt adding MJ2 callback

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

FAR Raycast mask: 557059 557063

I see these often as well. Looking at that code it seems like it might be tweaked a bit to handle those enumerators returning null elements, i.e., check for null before using elements' accessors. And, perhaps change the inner loop to be on Part rather than CLSPart instead of shadowing p and maybe check Spaces and Parts are non-null before iterating (assuming there's not a contract in the API that those can never be null.)

Thanks for this.
I am struggling for time to look into CLS stuff, however if you would like to send me a pull request I will be happy to pull it and issue a release.

Given codepoet's workload, I'll look at this section of code. I had a hand in it so I may be able to work it thru. I'll perform the pull.

Ok, just created a pull request for the fix.

Corrected long ago. with KSP version 0.90