Code: Select all
PriorityAIController.prototype.homeStation = function()
{
if (!this.__ltcache.oolite_homeStation || this.__ltcache.oolite_homeStation === null)
{
return null;
}
this.__ltcache.oolite_homeStation
is set. It happens only in this function, at points after this opening code snippet. That's important because of the logic in play here. And that's where I think there might be a logical fault. So, my reading of this code is:
If the
__ltcache.oolite_homeStation
property does not exist (or potentially, is equal to false or zero) OR the __ltcache.oolite_homeStation
property is exactly equal to null, then return a value of null.Which seems fairly straightforward. But, if the only place
oolite_homeStation
gets set is in code that comes after this bit, then oolite_homeStation
will never get set. Which means any other code that relies on having a value in oolite_homeStation
will not work as planned.Is my reading of this correct? Is my logic sound?
I think the first clause of that if statement is unnecessary. But I wanted to get some other opinions before I check in a code change.