From 1e47e95a8dd5d7169a0d0701257da78fed1a0758 Mon Sep 17 00:00:00 2001 From: alistair3149 Date: Mon, 9 Jan 2023 16:24:28 -0500 Subject: [PATCH] =?UTF-8?q?fix(search):=20=F0=9F=90=9B=20more=20robust=20n?= =?UTF-8?q?ull=20check=20for=20description?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/skins.citizen.search/gateway/mwActionApi.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/resources/skins.citizen.search/gateway/mwActionApi.js b/resources/skins.citizen.search/gateway/mwActionApi.js index a8d8b920..a95b7296 100644 --- a/resources/skins.citizen.search/gateway/mwActionApi.js +++ b/resources/skins.citizen.search/gateway/mwActionApi.js @@ -75,8 +75,13 @@ function convertDataToResults( data ) { case 'textextracts': return item.extract || ''; case 'pagedescription': - /* eslint-disable-next-line es-x/no-symbol-prototype-description */ - return item.pageprops.description.slice( 0, 60 ) + '...' || ''; + /* eslint-disable es-x/no-symbol-prototype-description */ + if ( item.pageprops && item.pageprops.description ) { + return item.pageprops.description.slice( 0, 60 ) + '...'; + /* eslint-enable es-x/no-symbol-prototype-description */ + } else { + return ''; + } } };