Page 1 of 1

player.ship.dockedStation is null error

Posted: Fri Mar 16, 2012 10:59 am
by DGill
Occasionally get the following error:

10:00:17.669 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (buoyRepair 1.3.1): TypeError: player.ship.dockedStation is null
10:00:17.669 [script.javaScript.exception.unexpectedType]: ../AddOns/BuoyRepair1.3.1.oxp/Scripts/buoyRepair.js, line 73.

Any suggestions as to why the condition should return null rather than docked?

line 73 is: if(player.ship.dockedStation.hasRole("repaired-buoy-station"))

Re: player.ship.dockedStation is null error

Posted: Fri Mar 16, 2012 11:14 am
by Commander McLane
The error occurs when this line is executed while you're no longer docked anymore. Therefore there is no station you are docked at, and that means null.

Some if-clause has to be re-written or added to the script in order to avoid this scenario.

Re: player.ship.dockedStation is null error

Posted: Fri Mar 16, 2012 11:24 am
by DGill
OK, thanks

Re: player.ship.dockedStation is null error

Posted: Fri Mar 16, 2012 11:28 am
by Commander McLane
Commander McLane wrote:
Some if-clause has to be re-written or added to the script in order to avoid this scenario.
Sorry, I was a little brain-dead there. Of course it's not "some" if-clause, but the one from line 73 you're quoting. Changing it to

Code: Select all

if(player.ship.isDocked && player.ship.dockedStation.hasRole("repaired-buoy-station"))
should suffice.

Re: player.ship.dockedStation is null error

Posted: Fri Mar 16, 2012 12:12 pm
by Eric Walch
DGill wrote:
Occasionally get the following error:

10:00:17.669 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (buoyRepair 1.3.1): TypeError: player.ship.dockedStation is null
10:00:17.669 [script.javaScript.exception.unexpectedType]: ../AddOns/BuoyRepair1.3.1.oxp/Scripts/buoyRepair.js, line 73.

Any suggestions as to why the condition should return null rather than docked?

line 73 is: if(player.ship.dockedStation.hasRole("repaired-buoy-station"))
I am a bit puzzled. The whole code of buoyRepair.js does not contain above line. Not in the current version 1.3.2 nor in an old version 1.2.5. "repaired-buoy-station" is the role of the station, but there is nowhere in the code a need to check if the player has docked at such a station.

The only check for a docked player is:

Code: Select all

	if (player.ship.docked)
    {
        this.buoyStatusTimer.stop();
    }
But there is never a check for a specific station, so it leaves me puzzled how you could find above quoted line 73?

Re: player.ship.dockedStation is null error

Posted: Fri Mar 16, 2012 2:18 pm
by DGill
Ok, I'll get vrs 1.3.2 from Wiki and re-install

thanks