From 95b40069bf0c8d57fe90419453ba31a7c5711db9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sun, 3 Mar 2019 04:17:05 +0100 Subject: [PATCH] apps-menu: Remove unnecessary check The function is always called with an array parameter (albeit it may be empty), so remove the unnecessary check and cut down on indentation. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/60 --- extensions/apps-menu/extension.js | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js index b3c3cff7..0a3b24aa 100644 --- a/extensions/apps-menu/extension.js +++ b/extensions/apps-menu/extension.js @@ -721,22 +721,20 @@ class ApplicationsButton extends PanelMenu.Button { } _displayButtons(apps) { - if (apps) { - for (let i = 0; i < apps.length; i++) { - let app = apps[i]; - let item; - if (app instanceof Shell.App) - item = this._applicationsButtons.get(app); - else - item = new PopupMenu.PopupSeparatorMenuItem(); - if (!item) { - item = new ApplicationMenuItem(this, app); - item.setDragEnabled(this._desktopTarget.hasDesktop); - this._applicationsButtons.set(app, item); - } - if (!item.actor.get_parent()) - this.applicationsBox.add_actor(item.actor); + for (let i = 0; i < apps.length; i++) { + let app = apps[i]; + let item; + if (app instanceof Shell.App) + item = this._applicationsButtons.get(app); + else + item = new PopupMenu.PopupSeparatorMenuItem(); + if (!item) { + item = new ApplicationMenuItem(this, app); + item.setDragEnabled(this._desktopTarget.hasDesktop); + this._applicationsButtons.set(app, item); } + if (!item.actor.get_parent()) + this.applicationsBox.add_actor(item.actor); } }