commit 9821db988dce9ea8da512027983a855b35636ef7
parent e1113209d5a04b96d8cc4847ac4cbea1fa289bc7
Author: Dan Stillman <dstillman@zotero.org>
Date: Sun, 11 Mar 2012 18:36:54 -0400
Fix "_observers.get(i).ref is undefined) errors
If a notifier observer caused another observer to be deleted, an error
would occur.
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git 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