Nivekk / KOS

Fully programmable autopilot mod for KSP.
Other
80 stars 30 forks source link

Every time a null reference exception happens, KOS stops running what I type. #113

Closed Dunbaratu closed 11 years ago

Dunbaratu commented 11 years ago

To re-create:

Open the terminal on a brand new craft you just put on the launchpad.

Open the debug console (alt-F12) to and click on the debug log and scroll it to the bottom so you'll see the log messages as they happen live.

Type "print target".

This causes a null pointer exception since you have no target currently selected. You see the null pointer exception appear in the debug log.

Now try using the terminal. You can't see what you type and are typing blind. Furthermore even if you type a proper command blindly, like LIST. or CEARSCREEN. - Then nothing happens. It's not running the commands you type. You have to toggle the power on the KOS unit off and on to clear the problem.

While I have been able to recreate this reliably by using "print target" as my test, I've also seen it lots of other places when null pointer exceptions happen. This is not an error report on the fact that print target generates a null pointer exception. That's bad but it's not what I'm trying to report here. What I'm reporting is the fact that KOS is not trapping its own null pointer exceptions and reacting to them gracefully. Given that KOS is under development I don't expect "get rid of all null pointer exceptions" to be something that will be achieved any time soon. What I'd rather see is "react to them more gracefully when they happen. Catch them and report them without breaking the mod."

Nivekk commented 11 years ago

Agreed, what I'll do for now is put a couple of blanket try catches, that still log the error to the log file, and give a 'helpful' error message but allow the OS to continue on.

Dunbaratu commented 11 years ago

Thank you very much. This will make it a lot easier for me to track down some of the problems I've been having.