From d591b714a32aa1857c0ec03c09aeb6902c8042a6 Mon Sep 17 00:00:00 2001 From: Xelio Date: Wed, 6 Mar 2013 13:35:18 +0800 Subject: [PATCH] Bug fix: handleDataResponse in map_data It throw error when val.deletedGameEntityGuids or val.gameEntities is null --- code/map_data.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/map_data.js b/code/map_data.js index 3da36190..34b34590 100644 --- a/code/map_data.js +++ b/code/map_data.js @@ -81,7 +81,7 @@ window.handleDataResponse = function(data, textStatus, jqXHR) { var ppp = []; var p2f = {}; $.each(m, function(qk, val) { - $.each(val.deletedGameEntityGuids, function(ind, guid) { + $.each(val.deletedGameEntityGuids || [], function(ind, guid) { if(getTypeByGuid(guid) === TYPE_FIELD && window.fields[guid] !== undefined) { $.each(window.fields[guid].options.vertices, function(ind, vertex) { if(window.portals[vertex.guid] === undefined) return true; @@ -92,7 +92,7 @@ window.handleDataResponse = function(data, textStatus, jqXHR) { window.removeByGuid(guid); }); - $.each(val.gameEntities, function(ind, ent) { + $.each(val.gameEntities || [], function(ind, ent) { // ent = [GUID, id(?), details] // format for links: { controllingTeam, creator, edge } // format for portals: { controllingTeam, turret }