From f3606d6f0f5928de379e0d3089e05e4605702fb0 Mon Sep 17 00:00:00 2001 From: Kevin Date: Sat, 2 Mar 2013 22:54:30 -0800 Subject: [PATCH] Fix neutral portals have broken random details --- code/portal_detail_display.js | 3 +-- code/portal_detail_display_tools.js | 2 +- code/portal_info.js | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/code/portal_detail_display.js b/code/portal_detail_display.js index 15dd160e..8e7a2a71 100644 --- a/code/portal_detail_display.js +++ b/code/portal_detail_display.js @@ -22,9 +22,8 @@ window.renderPortalDetails = function(guid) { var linksText = [linkExpl('links'), linkExpl(' ↳ ' + links.incoming+'  •  '+links.outgoing+' ↴')]; var player = d.captured && d.captured.capturingPlayerId - ? getPlayerName(d.captured.capturingPlayerId) + ? '' + getPlayerName(d.captured.capturingPlayerId) + '' : null; - player = ''+player+''; var playerText = player ? ['owner', player] : null; var time = d.captured diff --git a/code/portal_detail_display_tools.js b/code/portal_detail_display_tools.js index 9a50e1b7..1687f5d9 100644 --- a/code/portal_detail_display_tools.js +++ b/code/portal_detail_display_tools.js @@ -132,7 +132,7 @@ window.renderResonatorDetails = function(slot, level, nrg, dist, nick) { var meter = '' + fill + lbar + ''; } - nick = ''+nick+''; + nick = nick ? ''+nick+'' : null; return [meter, nick || '']; } diff --git a/code/portal_info.js b/code/portal_info.js index 2e2e2127..fdbc91c2 100644 --- a/code/portal_info.js +++ b/code/portal_info.js @@ -64,7 +64,7 @@ window.getAvgResoDist = function(d) { sum += parseInt(reso.distanceToPortal); resos++; }); - return sum/resos; + return resos ? sum/resos : 0; } window.getAttackApGain = function(d) {