From a76358eccb23680fda1285b486fbbb188d278c94 Mon Sep 17 00:00:00 2001 From: rrachasak Date: Tue, 16 Jan 2024 16:27:20 +0700 Subject: [PATCH] Fix DeepScan: Expression 'parseInt(maxPageElem.attr('id'))' always passes null check. Consider using 'isNaN()' instead if invalid number checking was intended. --- lib/v2/parliament/section77.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/v2/parliament/section77.js b/lib/v2/parliament/section77.js index b98d2cded97800..ab45fa31c9f691 100644 --- a/lib/v2/parliament/section77.js +++ b/lib/v2/parliament/section77.js @@ -68,7 +68,10 @@ module.exports = async (ctx) => { const maxPageElem = $('#pagination-more_new a[id]:last-child'); if (maxPageElem.length) { - pageCnt = parseInt(maxPageElem.attr('id')) ?? 1; + pageCnt = parseInt(maxPageElem.attr('id') ?? '1') ?? 1; + if (isNaN(pageCnt)) { + pageCnt = 1; + } } const actList = await Promise.all(