Jump to content

CommNet.CommNetVessel.InPlasma causing a StackOverflow


Recommended Posts

When calling CommNet.CommNetVessel.InPlasma I get a StackOverflowException

in C# with just a simple if statement

variable v is a reference to a Vessel and all access to v.connection works as expected until the if (v.connection.InPlasma) statement. 

// are we connected to DSN
if (v.connection.IsConnected)
{
  return new ConnectionInfo(v.connection.ControlPath.First.hopType == HopType.Home ? LinkStatus.direct_link : LinkStatus.indirect_link,
    ext_rate * v.connection.SignalStrength, v.connection.SignalStrength, ext_cost,
    Lib.Ellipsis(Localizer.Format(v.connection.ControlPath.First.end.displayName).Replace("Kerbin", "DSN"), 20));
}
// is loss of connection due to plasma blackout
else if (v.connection.InPlasma)  // calling InPlasma causes a StackOverflow :(
  return new ConnectionInfo(LinkStatus.blackout);

Log output is:

[EXC 12:26:21.322] StackOverflowException: The requested operation caused a stack overflow.     CommNet.CommNetVessel.get_InPlasma ()

with none of the usual debug info like the filename and line number etc you usually get with exceptions.

I suspect this is an error in KSP's code.

Using reflection to access the private field inPlasma gives a correct value.

 

Also posted here: 

 

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...