Fix error when importing data while eggs list is empty

pull/14/head
Flashfyre 2023-12-31 18:53:16 -05:00
parent 1ad25bdf61
commit 183b53286e
1 changed files with 2 additions and 0 deletions

View File

@ -285,6 +285,8 @@ export class GameData {
return JSON.parse(dataStr, (k: string, v: any) => { return JSON.parse(dataStr, (k: string, v: any) => {
if (k === 'eggs') { if (k === 'eggs') {
const ret: EggData[] = []; const ret: EggData[] = [];
if (v === null)
v = [];
for (let e of v) for (let e of v)
ret.push(new EggData(e)); ret.push(new EggData(e));
return ret; return ret;