defensive code for when the document sometimes isn't there on server restarts. (#26)

This commit is contained in:
John Barlow 2020-10-27 18:55:29 -04:00 committed by GitHub
parent a9b20ae99d
commit 5e0ee3e8d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -219,6 +219,7 @@ export default class SocketIOCollaboration {
garbageCursors = (nsp: string) => { garbageCursors = (nsp: string) => {
const doc = this.backend.getDocument(nsp) const doc = this.backend.getDocument(nsp)
if (doc == null || doc == undefined) return;
if (!doc.cursors) return if (!doc.cursors) return
const namespace = this.io.of(nsp) const namespace = this.io.of(nsp)