Skip to content

Commit

Permalink
return [] for non-iterable achievements data
Browse files Browse the repository at this point in the history
  • Loading branch information
Esummins committed May 9, 2024
1 parent f48fcc9 commit 4d87da1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/parsers/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ type AchievementsRet = Number[];
function parseAchievements(player: any): AchievementsRet {
try {
let achievementsCompleted: Number[] = [];
if (player.achievements == "") return [];
if (!player.achievements || player.achievements == "") return [];
if (typeof player.achievements.int[Symbol.iterator] !== "function")
return [];
for (const a of player.achievements.int) {
achievementsCompleted.push(a);
}
Expand Down

0 comments on commit 4d87da1

Please sign in to comment.