From 4aabfaf07f244eef3b426acd13596e5f8e227331 Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Thu, 2 Jul 2015 04:20:00 -0400 Subject: [PATCH] Fix crashes related to empty teams --- js/storage.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/js/storage.js b/js/storage.js index 6a2fa4321..25289960c 100644 --- a/js/storage.js +++ b/js/storage.js @@ -87,6 +87,8 @@ Storage.saveAllTeams = function() { *********************************************************/ Storage.unpackAllTeams = function(buffer) { + if (!buffer) return []; + if (buffer.charAt(0) === '[') { // old format return JSON.parse(buffer).map(function (oldTeam) { @@ -478,6 +480,7 @@ Storage.getTeamIcons = function(team) { }; Storage.getPackedTeam = function(team) { + if (!team) return null; if (team.iconCache === '!') { // see the same case in Storage.getTeamIcons team.team = Storage.packTeam(Storage.activeSetList);