Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullReferenceException from ModuleActiveRadiator.IsSibling #249

Closed
BrettRyland opened this issue Sep 2, 2024 · 3 comments
Closed

NullReferenceException from ModuleActiveRadiator.IsSibling #249

BrettRyland opened this issue Sep 2, 2024 · 3 comments
Labels
kspBug Identified KSP issue
Milestone

Comments

@BrettRyland
Copy link

An issue I often see in my logs comes from when radiators are being used (typically in conjunction with a nuclear power supply). When one of them gets destroyed (e.g., during space combat with BDArmory), the log gets a long string of the following exception until the other radiators get destroyed too.

[EXC 09:05:05.451] NullReferenceException: Object reference not set to an instance of an object
  ModuleActiveRadiator.IsSibling (Part targetPart) (at <be370b73275e49439ea5e41ceef6700f>:0)
  ModuleCoreHeat.MoveCoreEnergyToRadiators (System.Double excess, System.Double deltaTime) (at <be370b73275e49439ea5e41ceef6700f>:0)
  ModuleCoreHeat.FixedUpdate () (at <be370b73275e49439ea5e41ceef6700f>:0)
  UnityEngine.DebugLogHandler:LogException(Exception, Object)
  ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
  UnityEngine.Debug:CallOverridenDebugHandler(Exception, Object)

This is a call that's part of KSP's heat system ModuleActiveRadiator.IsSibling
Is there anything that can be done to fix this?

The full log is KSP.zip

@JonnyOThan
Copy link
Contributor

@BrettRyland Can you provide repro steps using only a stock install? The object thrower might be useful to destroy a radiator, or just aim an engine at one.

@BrettRyland
Copy link
Author

After a bit of digging, I've found that this could be considered a part configuration issue, so I fully understand if you consider this to be a "won't fix", though a fix for it would still be nice to have.

Essentially, if a part has both a ModuleCoreHeat module and a ModuleActiveRadiator module and the config option parentCoolingOnly = true is set in the ModuleActiveRadiator module, then if that part becomes detached such that there is no parent part, then it starts throwing the exception. Changing parentCoolingOnly to false avoids the exception, but means that the part then cools the entire vessel. Ideally, if a part has both of these modules, then the intention of the parentCoolingOnly option should be to apply cooling to only this part instead of the parent one, which would allow for heat producing parts with built-in radiators.

The only part I know of to have such a configuration is the "NUK-3 Aerospace Fission Reactor" from the "Mk2 Expansion" mod (Mk2Expansion/Parts/Utility/Reactor/part.cfg) where the cooling is built into the reactor (which is what was triggering the exceptions in the original post).

Stock KSP doesn't have such a part, but adding the ModuleActiveRadiator radiator from the radPanelEdge.cfg panel to the MiniISRU is sufficient to trigger the issue. repro.zip contains a demo vessel and the modified MiniISRU part config. Steps to reproduce triggering the exception are to spawn the craft on the runway and then detach the MiniISRU via the decoupler between it and the cockpit once the core temperature of the MiniISRU is over 1000K.

@gotmachine
Copy link
Contributor

Fixed in cc18471
Thanks for the detailed report !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kspBug Identified KSP issue
Development

No branches or pull requests

3 participants