From 16c0b7374d6bfbbcd5c8cd5a9200bfba0d086eee Mon Sep 17 00:00:00 2001 From: DianaXWiki <139217939+DianaXWiki@users.noreply.github.com> Date: Thu, 31 Oct 2024 18:59:33 +0200 Subject: [PATCH] Add more checks for check function --- www/common/extensions.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/www/common/extensions.js b/www/common/extensions.js index f7fda6311..72755c34b 100644 --- a/www/common/extensions.js +++ b/www/common/extensions.js @@ -11,11 +11,22 @@ define([ let e = ext[id]; if (!Array.isArray(e)) { e = []; } return e.map(_ext => { - return new Promise((resolve, reject) => { - if (typeof(ext.check) !== "function") { return void resolve(_ext); } - ext.check().then(() => { + return new Promise((resolve) => { + if (typeof _ext.check === "function") { + const checkResult = _ext.check(); + if (checkResult && typeof checkResult.then === "function") { + checkResult.then(() => { + resolve(_ext); + }).catch(() => { + console.error("Check failed for extension:", _ext); + resolve(null); + }); + } else { + resolve(_ext); + } + } else { resolve(_ext); - }).catch(reject); + } }); }); };