From bdf290adb229bd1fbf8d2bbccca2bbc31d96e427 Mon Sep 17 00:00:00 2001
From: Kevin Jahns <kevin.jahns@rwth-aachen.de>
Date: Wed, 30 Dec 2015 16:37:35 +0100
Subject: [PATCH] added safety to setUserId (when called twice)

---
 README.md        | 1 +
 dist             | 2 +-
 src/Connector.js | 8 ++++++--
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 86620de0..a804697f 100644
--- a/README.md
+++ b/README.md
@@ -144,3 +144,4 @@ Yjs is licensed under the [MIT License](./LICENSE.txt).
 
 [ShareJs]: https://github.com/share/ShareJS
 [OpenCoweb]: https://github.com/opencoweb/coweb/wiki
+
diff --git a/dist b/dist
index 8ba1e4ce..ab6a193e 160000
--- a/dist
+++ b/dist
@@ -1 +1 @@
-Subproject commit 8ba1e4ce27a75bb025a5478723ea57f7f437ccf0
+Subproject commit ab6a193ec6ec799bdb77fa23eeec1f05d5b910d6
diff --git a/src/Connector.js b/src/Connector.js
index 0a1bb4e1..bc55ccf2 100644
--- a/src/Connector.js
+++ b/src/Connector.js
@@ -63,8 +63,12 @@ module.exports = function (Y/* :any */) {
       return this.y.db.stopGarbageCollector()
     }
     setUserId (userId) {
-      this.userId = userId
-      return this.y.db.setUserId(userId)
+      if (this.userId == null) {
+        this.userId = userId
+        return this.y.db.setUserId(userId)
+      } else {
+        return null
+      }
     }
     onUserEvent (f) {
       this.userEventListeners.push(f)
-- 
GitLab