From 7236bef8cdb9d6817fd4330ac637c8a1db99286f Mon Sep 17 00:00:00 2001 From: Raxit Majithiya Date: Wed, 1 Feb 2023 09:52:55 -0500 Subject: [PATCH] Fix runtime error if the app directory doesn't exist. This can happen for spacer-tiles. Fixes #1 --- utils.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/utils.js b/utils.js index ff0168e..276278f 100644 --- a/utils.js +++ b/utils.js @@ -37,10 +37,9 @@ function getAppNamesToIconPaths(parsedDockData) { for (const parsedAppData of persistentApps) { const appName = parsedAppData.dict[0].string[1]; - const appDirectoryUrl = parsedAppData.dict[0].dict[0].string[0]; - const appDirectory = url.fileURLToPath(appDirectoryUrl) - - if (isAppNameAllowed(appName)) { + const appDirectoryUrl = parsedAppData.dict[0].dict?.[0].string[0]; + if (appDirectoryUrl && isAppNameAllowed(appName)) { + const appDirectory = url.fileURLToPath(appDirectoryUrl) result[appName] = getIconPath(appDirectory); } }