mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-12-01 01:16:38 +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 = [];
|
const results = [];
|
||||||
|
|
||||||
|
if (typeof data?.query?.pages === 'undefined') {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
/* eslint-disable-next-line compat/compat, es/no-object-values */
|
/* eslint-disable-next-line compat/compat, es/no-object-values */
|
||||||
data = Object.values( data.query.pages );
|
data = Object.values( data.query.pages );
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ function getUrl( input ) {
|
||||||
function convertDataToResults( data ) {
|
function convertDataToResults( data ) {
|
||||||
const results = [];
|
const results = [];
|
||||||
|
|
||||||
data = data.pages;
|
data = data?.pages ?? [];
|
||||||
|
|
||||||
for ( let i = 0; i < data.length; i++ ) {
|
for ( let i = 0; i < data.length; i++ ) {
|
||||||
results[ i ] = {
|
results[ i ] = {
|
||||||
|
|
Loading…
Reference in a new issue