From 943cbd3562cc2b5e4f89817c6caffaa0fc925e6d Mon Sep 17 00:00:00 2001 From: dickreckard Date: Thu, 6 Nov 2014 11:59:54 +0100 Subject: [PATCH] added line to prevent JSON errors to crash the whole thing --- webapp.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/webapp.html b/webapp.html index 3964ca7..6a4dbd8 100644 --- a/webapp.html +++ b/webapp.html @@ -268,8 +268,12 @@ function updateInboxView() { if ( localStorage.key(i).length < 10 || element === 'outbox' ) { continue; } -// alert(element); - elementj = JSON.parse(element); +// alert(element); + try { + elementj = JSON.parse(element); + } catch (e) { + continue; + } localStorageArray[i] = { time:localStorage.key(i), user:elementj.name, message:elementj.message, node:elementj.node, hops:elementj.hops }; }