From 56e79fe10c8bf8ad0cb31c84e79233530a6cc595 Mon Sep 17 00:00:00 2001 From: wrycta Date: Thu, 11 Apr 2013 10:34:57 +0800 Subject: [PATCH] Fixes ipas-link in the case that resos are missing Adds dummy values to the hash, with energyTotal=0 for that resonator --- plugins/ipas-link.user.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/ipas-link.user.js b/plugins/ipas-link.user.js index 4aaa6227..3434a737 100644 --- a/plugins/ipas-link.user.js +++ b/plugins/ipas-link.user.js @@ -33,7 +33,12 @@ window.plugin.ipasLink.addLink = function(d) { window.plugin.ipasLink.getHash = function(d) { var hashParts=[]; $.each(d.resonatorArray.resonators, function(ind, reso) { - hashParts.push(reso.level + "," + reso.distanceToPortal + "," + reso.energyTotal); + if ($reso) { + hashParts.push(reso.level + "," + reso.distanceToPortal + "," + reso.energyTotal); + } else { + hashParts.push(1 + "," + 35 + "," + 0); // Dummy values, the only important one is energy=0 + } + } }); return hashParts.join(";")+"|" + "0,0,0,0"; //shields not implemented yet }