Jump to content

Debugging a problem with the PatchedConicRenderer?


Guest

Recommended Posts

I know my code caused this but I can't find the direct cause because it happens outside of my code execution chain.

NullReferenceException: Object reference not set to an instance of an object
at PatchedConicRenderer.OnGUI () [0x00000] in <filename unknown>:0

(Filename: Line: -1)

Is there any way to figure out what might be happening here?

Link to comment
Share on other sites

Hm, don't think there is a good way to "debug" anything within KSP. I really wished they would offer a dev build, so we could attach unities mono-develop to it. Maybe KerbalKon is a good opportunity to ask for it! Anyway, you could dump lot of its variables and check for null values... but that requires a lot of effort. In what way is your plugin manipulating this KSP module? Maybe checking out those related objects and comparing them to well working ones does the job?

Link to comment
Share on other sites

As it's the PatchedConicRenderer's OnGUI method that's having issues, I'm guessing that you have an OnGUI method that has left things in an invalid state somehow, and PatchedConicRenderer is the first thing to hit it. I would start looking there. Try adding a second KSPAddon class that also calls OnGUI so that the failure happens in code you control.

Link to comment
Share on other sites

I only have a tiny bit of code that executes outside of OnGUI() and I just fixed a layout issue I was having when this popped up. I figured out last night that the issue happens when I update the flight plan after changing a maneuver node while I have an encounter but I can't, for the life of me, figure out why that is happening because I don't delete anything SQUAD set and I'm not creating new maneuver node gizmos.

I think Faark is right, it's time to dump variables. Thanks for the hints.

Link to comment
Share on other sites

You could always post your source code here - that could help.

I'm about to start my commute :( If I'm still having issues later tonight I'll get it all up on Github and post a link.

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...