From 9821db988dce9ea8da512027983a855b35636ef7 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 11 Mar 2012 18:36:54 -0400 Subject: [PATCH] Fix "_observers.get(i).ref is undefined) errors If a notifier observer caused another observer to be deleted, an error would occur. --- chrome/content/zotero/xpcom/notifier.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/chrome/content/zotero/xpcom/notifier.js b/chrome/content/zotero/xpcom/notifier.js index 713fc41cab..01cda49652 100644 --- a/chrome/content/zotero/xpcom/notifier.js +++ b/chrome/content/zotero/xpcom/notifier.js @@ -145,6 +145,12 @@ Zotero.Notifier = new function(){ for (var i in _observers.items){ Zotero.debug("Calling notify('" + event + "') on observer with hash '" + i + "'", 4); + + if (!_observers.get(i)) { + Zotero.debug("Observer no longer exists"); + continue; + } + // Find observers that handle notifications for this type (or all types) if (!_observers.get(i).types || _observers.get(i).types.indexOf(type)!=-1){ // Catch exceptions so all observers get notified even if