From 6312cfaf2062ebad252911615187ba983c33759b Mon Sep 17 00:00:00 2001 From: ccd0 Date: Thu, 26 Feb 2015 21:53:57 -0800 Subject: [PATCH] Make thread watcher more robust against corrupt data. #341 --- src/Monitoring/ThreadWatcher.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Monitoring/ThreadWatcher.coffee b/src/Monitoring/ThreadWatcher.coffee index 23ca14ead..20285d040 100755 --- a/src/Monitoring/ThreadWatcher.coffee +++ b/src/Monitoring/ThreadWatcher.coffee @@ -134,8 +134,8 @@ ThreadWatcher = {db} = ThreadWatcher boardID = g.BOARD.ID db.forceSync() - for threadID, data of db.data.boards[boardID] when not data.isDead and threadID not of g.BOARD.threads - if Conf['Auto Prune'] + for threadID, data of db.data.boards[boardID] when not data?.isDead and threadID not of g.BOARD.threads + if Conf['Auto Prune'] or not (data and typeof data is 'object') ThreadWatcher.db.delete {boardID, threadID} else data.isDead = true @@ -248,7 +248,7 @@ ThreadWatcher = for boardID, threads of ThreadWatcher.db.data.boards if Conf['Current Board'] and boardID isnt g.BOARD.ID continue - for threadID, data of threads + for threadID, data of threads when data and typeof data is 'object' all.push {boardID, threadID, data} all