Skip to content

Commit 39dce8c

Browse files
committed
update
1 parent 5d13a59 commit 39dce8c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/puremvc/core/View.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,12 @@ def notify_observers(self, notification: INotification) -> None:
122122
"""
123123
# Get a reference to the observer list for this notification name
124124
with self.observerMapLock:
125-
observers = self.observerMap.get(notification.name)
125+
# Copy observers (observers[:]) from reference array to a working array,
126+
observers = list(self.observerMap.get(notification.name) or [])
126127

127-
# Copy observers (observers[:]) from reference array to a working array,
128128
# since the reference array may change during the notification loo
129129
# Safe iteration, create a shallow copy of observers or use an empty list if observers is None or falsy.
130-
for observer in list(observers or []):
130+
for observer in observers:
131131
# Notify Observers from the working array
132132
observer.notify_observer(notification)
133133

0 commit comments

Comments
 (0)