Skip to content

Commit e668c59

Browse files
committed
improve code clarity
1 parent 55d292a commit e668c59

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

files/usr/share/cinnamon/applets/[email protected]/applet.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,10 @@ class Notifications {
235235
this._appGroupList.forEach(appGroup => {
236236
if (!appGroup.groupState || appGroup.groupState.willUnmount) return;
237237
if (appId === appGroup.groupState.appId) {
238-
let i = 0;
239-
while (appGroup.notifications[i]) {
240-
if (!appGroup.notifications[i]._destroyed) {
238+
// iterate backwards due to in place array modification
239+
for (let i = appGroup.notifications.length - 1; i >= 0; i--) {
240+
if (appGroup.notifications[i] && !appGroup.notifications[i]._destroyed) {
241241
appGroup.notifications[i].destroy(NotificationDestroyedReason.DISMISSED);
242-
} else {
243-
i++;
244242
}
245243
}
246244
appGroup.notifications = [];

0 commit comments

Comments
 (0)