From 215761557dd42ac7e2d237faea2a67ae6dd4ae09 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 13 May 2013 18:44:22 +0200 Subject: [PATCH] Looks like some users had a `null` value on a board with the Unread features. No idea how that could have happened. --- src/General/DataBoard.coffee | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/General/DataBoard.coffee b/src/General/DataBoard.coffee index 499ffccca..1d6d30a3f 100644 --- a/src/General/DataBoard.coffee +++ b/src/General/DataBoard.coffee @@ -56,17 +56,13 @@ class DataBoard val or defaultValue clean: -> - for boardID of @data.boards - try - @deleteIfEmpty {boardID} - catch err - # XXX I get obscure reports of: - # "Unread" initialization crashed. TypeError: Object.keys called on non-object - # comming from here, gotta figure out why that happens. - Main.logError - message: "Couldn't deleteIfEmpty on:\n#{JSON.stringify @data}\n" - error: err + for boardID, val of @data.boards + # XXX tmp fix for users that had the `null` + # value for a board with the Unread features: + unless val delete @data.boards[boardID] + else + @deleteIfEmpty {boardID} now = Date.now() if (@data.lastChecked or 0) < now - 2 * $.HOUR