summaryrefslogtreecommitdiff
path: root/src/node/db
diff options
context:
space:
mode:
authorgoldquest <tjwelde@gmail.com>2014-03-14 17:50:37 +0100
committergoldquest <tjwelde@gmail.com>2014-03-14 17:50:37 +0100
commita00c5054038393332cdc2e257f4f4817bfdc95b5 (patch)
tree793076f5656734e30f00d3451901034c383f3f6b /src/node/db
parentcc03f5374cb1027b60a5cd09d9223f68b12ba50c (diff)
downloadetherpad-lite-a00c5054038393332cdc2e257f4f4817bfdc95b5.zip
Sometimes, the author2session / group2session don't exist anymore, but the session does.
It should be possible to delete a session, if they don't exist
Diffstat (limited to 'src/node/db')
-rw-r--r--src/node/db/SessionManager.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/node/db/SessionManager.js b/src/node/db/SessionManager.js
index b6ff1ce9..71315adc 100644
--- a/src/node/db/SessionManager.js
+++ b/src/node/db/SessionManager.js
@@ -263,12 +263,16 @@ exports.deleteSession = function(sessionID, callback)
db.remove("session:" + sessionID);
//remove session from group2sessions
- delete group2sessions.sessionIDs[sessionID];
- db.set("group2sessions:" + groupID, group2sessions);
-
+ if(group2sessions != null) { // Maybe the group was already deleted
+ delete group2sessions.sessionIDs[sessionID];
+ db.set("group2sessions:" + groupID, group2sessions);
+ }
+
//remove session from author2sessions
- delete author2sessions.sessionIDs[sessionID];
- db.set("author2sessions:" + authorID, author2sessions);
+ if(author2sessions != null) { // Maybe the author was already deleted
+ delete author2sessions.sessionIDs[sessionID];
+ db.set("author2sessions:" + authorID, author2sessions);
+ }
callback();
}