From c98d2639286344188f50045ab2e28a157df7ddf7 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Wed, 12 Oct 2016 17:50:36 +0800 Subject: [PATCH] Fix to handle undefined document on update history --- lib/realtime.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/realtime.js b/lib/realtime.js index ea3735a..d069a48 100644 --- a/lib/realtime.js +++ b/lib/realtime.js @@ -396,7 +396,7 @@ function finishConnection(socket, note, user) { // update user note history setTimeout(function () { var noteId = note.alias ? note.alias : LZString.compressToBase64(note.id); - history.updateHistory(user.userid, noteId, note.server.document); + if (note.server) history.updateHistory(user.userid, noteId, note.server.document); }, 0); emitOnlineUsers(socket); @@ -669,7 +669,7 @@ function operationCallback(socket, operation) { // update user note history setTimeout(function() { var noteId = note.alias ? note.alias : LZString.compressToBase64(note.id); - history.updateHistory(userId, noteId, note.server.document); + if (note.server) history.updateHistory(userId, noteId, note.server.document); }, 0); }