From 132c72c7b75b7c69ec713cd9c44b7566da7f052a Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Mon, 26 Jul 2021 00:36:19 +0200 Subject: [PATCH] luci-app-attendedsysupgrade: fix empty array condition In JavaScript (other than in Python) an empty array is considered `true` within if statements. Fix this by checking for the array length rather than its existence. This fixes the issue of an empty dropdown menu in case the user is running the latest release. Signed-off-by: Paul Spooren (cherry picked from commit 7f5becc69e004f831c9dc09e0859c179b439c7d2) --- .../luci-static/resources/view/attendedsysupgrade/overview.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/luci-app-attendedsysupgrade/htdocs/luci-static/resources/view/attendedsysupgrade/overview.js b/applications/luci-app-attendedsysupgrade/htdocs/luci-static/resources/view/attendedsysupgrade/overview.js index f6d31a35be..3ee99684da 100644 --- a/applications/luci-app-attendedsysupgrade/htdocs/luci-static/resources/view/attendedsysupgrade/overview.js +++ b/applications/luci-app-attendedsysupgrade/htdocs/luci-static/resources/view/attendedsysupgrade/overview.js @@ -255,7 +255,7 @@ function check_sysupgrade(server_url, current_version, target, board_name, packa } } } - if (candidates) { + if (candidates.length) { var m, s, o; var mapdata = { -- 2.30.2