Index: binaries/data/mods/public/simulation/components/GuiInterface.js =================================================================== --- binaries/data/mods/public/simulation/components/GuiInterface.js +++ binaries/data/mods/public/simulation/components/GuiInterface.js @@ -641,7 +641,11 @@ */ GuiInterface.prototype.GetIncomingAttacks = function(player) { - return QueryPlayerIDInterface(player, IID_AttackDetection).GetIncomingAttacks(); + let cmpAttackDetection = QueryPlayerIDInterface(player, IID_AttackDetection); + if (!cmpAttackDetection) + return []; + + return cmpAttackDetection.GetIncomingAttacks(); }; /** @@ -727,7 +731,11 @@ GuiInterface.prototype.GetAvailableFormations = function(player, wantedPlayer) { - return QueryPlayerIDInterface(wantedPlayer).GetFormations(); + let cmpPlayer = QueryPlayerIDInterface(wantedPlayer); + if (!cmpPlayer) + return []; + + return cmpPlayer.GetFormations(); }; GuiInterface.prototype.GetFormationRequirements = function(player, data) @@ -1917,7 +1925,11 @@ GuiInterface.prototype.GetTradingGoods = function(player) { - return QueryPlayerIDInterface(player).GetTradingGoods(); + let cmpPlayer = QueryPlayerIDInterface(player); + if (!cmpPlayer) + return []; + + return cmpPlayer.GetTradingGoods(); }; GuiInterface.prototype.OnGlobalEntityRenamed = function(msg) Index: binaries/data/mods/public/simulation/components/PlayerManager.js =================================================================== --- binaries/data/mods/public/simulation/components/PlayerManager.js +++ binaries/data/mods/public/simulation/components/PlayerManager.js @@ -87,11 +87,11 @@ if (id in this.playerEntities) return this.playerEntities[id]; - // All players at or below ID 0 get gaia-level data. (Observers for example) - if (id <= 0) - return this.playerEntities[0]; + // Observers don't have player data. + if (id == -1) + return INVALID_ENTITY; - var stack = new Error().stack.trimRight().replace(/^/mg, ' '); // indent each line + let stack = new Error().stack.trimRight().replace(/^/mg, ' '); // indent each line warn("GetPlayerByID: no player defined for id '"+id+"'\n"+stack); return INVALID_ENTITY;