KSP-KOS/KOS

Object refference error when getting part lists on unloaded vessels [BUG]

Opened this issue · 0 comments

This was posted to the kOS subreddit, the issue is that for unloaded vessel should you try to read part lists ( and possibly others I only tested parts ) of unloaded vessels kOS will crash with an "Object Reference not set to an instance of an object'" error.

This is the code I used to reproduce the error

LOCAL tarList IS LIST().
LIST TARGETS IN tarList.
FOR tar IN tarList {
    PRINT tar:NAME.
    PRINT tar:DOCKINGPORTS.
}

This does require having other craft in the save that are unloaded.

Of particular note kOS will only crash for a unloaded vessel the first time it tries to get the list all follow on attempts will work and produce the expected empty list. Also if you go through a load of some kind the vessels that didn't crash will crash on the first query. So my initial guess would be that this is caused by something going wrong in the caching we do for some things in KSP.