mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-11-28 08:10:45 +00:00
fix: add null check when accessing undefined keys
Co-authored-by: Hannes Kruse <hannes@octofox.de>
This commit is contained in:
parent
580f80bacc
commit
48deb87709
|
@ -80,6 +80,10 @@ function convertDataToResults( data ) {
|
|||
|
||||
const results = [];
|
||||
|
||||
if (typeof data?.query?.pages === 'undefined') {
|
||||
return [];
|
||||
}
|
||||
|
||||
/* eslint-disable-next-line compat/compat, es/no-object-values */
|
||||
data = Object.values( data.query.pages );
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ function getUrl( input ) {
|
|||
function convertDataToResults( data ) {
|
||||
const results = [];
|
||||
|
||||
data = data.pages;
|
||||
data = data?.pages ?? [];
|
||||
|
||||
for ( let i = 0; i < data.length; i++ ) {
|
||||
results[ i ] = {
|
||||
|
|
Loading…
Reference in a new issue