Fix "_observers.get(i).ref is undefined) errors

If a notifier observer caused another observer to be deleted, an error
would occur.
This commit is contained in:
Dan Stillman 2012-03-11 18:36:54 -04:00
parent e1113209d5
commit 9821db988d

View file

@ -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