shadowmage45 / SSTULabs

Dev repository for testing/unfinished KSP parts/plugins/etc.
Other
62 stars 41 forks source link

ModularPart with zero volume causes NRE #738

Closed shadowmage45 closed 5 years ago

shadowmage45 commented 5 years ago

ST-HAB-A1 with default configuration causes the following exceptions in the log when the 'configure containers' button is pressed:

[EXC 11:28:16.391] NullReferenceException: Object reference not set to an instance of an object
    SSTUTools.VolumeContainerGUI.updateGuiData ()
    SSTUTools.SSTUVolumeContainer.OnGUI ()

Switching even one of the end-caps to something else with volume, and the error does not occur. Switching back to the zero-volume endcap after the GUI is open does not cause an error, so the run-time bits of the system have no problem with zero volume, only the setup/initialization routines have issues.

Likely cause is that the container data is not being constructed, as it has zero volume, and thus nothing is presented to the GUI to display/manipulate.

As there is no (easy/simple/robust) way to disable the GUI opening button in the stock PAW, the robable solution is to instantiate UI-side containers even for zero-volume setups.

shadowmage45 commented 5 years ago

Fixed in dev -- window will properly refuse to open if no containers are available.

Investigating alternate fix to display a blank/empty window, or at least pop an error message regarding no available containers.