From 00960d522d3ee296db58960560a177fd8e6a688a Mon Sep 17 00:00:00 2001 From: Stan Grishin Date: Sun, 4 Feb 2024 01:46:22 +0000 Subject: luci-app-adblock-fast: bugfix: prevent runtime errors on empty warning/messages Signed-off-by: Stan Grishin --- .../htdocs/luci-static/resources/adblock-fast/status.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js') diff --git a/applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js b/applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js index 703eb4ff7b..1040cfb369 100644 --- a/applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js +++ b/applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js @@ -201,8 +201,11 @@ var status = baseclass.extend({ ); var text = ""; reply.status.warnings.forEach((element) => { - text += - warningTable[element.id].format(element.extra || " ") + "
"; + if (element.id && warningTable[element.id]) + text += + warningTable[element.id].format(element.extra || " ") + + "
"; + else text += _("Unknown warning") + "
"; }); var warningsText = E("div", {}, text); var warningsField = E( @@ -292,8 +295,10 @@ var status = baseclass.extend({ ); var text = ""; reply.status.errors.forEach((element) => { - text += - errorTable[element.id].format(element.extra || " ") + "!
"; + if (element.id && errorTable[element.id]) + text += + errorTable[element.id].format(element.extra || " ") + "!
"; + else text += _("Unknown error") + "
"; }); text += _("Errors encountered, please check the %sREADME%s").format( '', -- cgit v1.2.3