aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/app.js b/app.js
index 668f4b2..5ad1547 100644
--- a/app.js
+++ b/app.js
@@ -143,7 +143,13 @@ function route () {
// contact new items from the log onto the client's log of everything
var num = serverData.log.length - clientLog.log.length
var diff = serverData.log.slice(0, num)
- var oldLog = JSON.parse(localStorage['log'])
+
+ if (localStorage['log']) {
+ var oldLog = JSON.parse(localStorage['log'])
+ } else {
+ var oldLog = []
+ }
+
var newLog = diff.concat(oldLog)
localStorage['log'] = JSON.stringify(newLog)