From b42309b7c848d73b679ea001c0337e87f2adb0d7 Mon Sep 17 00:00:00 2001 From: Philip Langdale Date: Mon, 23 Sep 2024 13:33:21 -0700 Subject: [PATCH] locations: handle lack of dock manager in GetApps() This method may be called in situations where there is no dock manager, so handle it gracefully, rather than letting an exception propagate. In some situations, this method may end up getting called in the context of another extension and the un-caught exception can terminate that extension. --- locations.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/locations.js b/locations.js index 85d71e252..ba25c4dad 100644 --- a/locations.js +++ b/locations.js @@ -1486,12 +1486,13 @@ function getApps() { const dockManager = Docking.DockManager.getDefault(); const locationApps = []; - if (dockManager.removables) - locationApps.push(...dockManager.removables.getApps()); - - if (dockManager.trash) - locationApps.push(dockManager.trash.getApp()); + if (dockManager) { + if (dockManager.removables) + locationApps.push(...dockManager.removables.getApps()); + if (dockManager.trash) + locationApps.push(dockManager.trash.getApp()); + } return locationApps; }