From ebd8b85072dbb795f21a31b745a024cf356ba2c9 Mon Sep 17 00:00:00 2001 From: John McLear Date: Wed, 27 Feb 2013 16:17:50 +0000 Subject: [PATCH] patch documented here https://github.com/ether/etherpad-lite/issues/472 adds some stability but not a perfect solution --- src/node/handler/PadMessageHandler.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js index 08ddde0e9..15a9b8eab 100644 --- a/src/node/handler/PadMessageHandler.js +++ b/src/node/handler/PadMessageHandler.js @@ -586,7 +586,14 @@ function handleUserChanges(client, message) // client) are relative to revision r - 1. The follow function // rebases "changeset" so that it is relative to revision r // and can be applied after "c". - changeset = Changeset.follow(c, changeset, false, apool); + try + { + changeset = Changeset.follow(c, changeset, false, apool); + }catch(e){ + console.warn("Can't apply USER_CHANGES "+changeset+", possibly because of mismatched follow error"); + client.json.send({disconnect:"badChangeset"}); + return; + } if ((r - baseRev) % 200 == 0) { // don't let the stack get too deep async.nextTick(callback);