aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-03-19 18:04:10 -0500
committermat <github@matdoes.dev>2022-03-19 19:51:33 -0500
commit53ebb73fa06f6b41793757375dea40bff75bef7e (patch)
tree978bbb372f9816de8089e6b4acee0fd02e75199f
parent8843ccf72f076c26970cad5ce3c878f893ec9d54 (diff)
downloadskyblock-api-53ebb73fa06f6b41793757375dea40bff75bef7e.tar.gz
skyblock-api-53ebb73fa06f6b41793757375dea40bff75bef7e.tar.bz2
skyblock-api-53ebb73fa06f6b41793757375dea40bff75bef7e.zip
Fix error when there is no slayer data
-rw-r--r--src/cleaners/skyblock/slayers.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cleaners/skyblock/slayers.ts b/src/cleaners/skyblock/slayers.ts
index a47829a..4852160 100644
--- a/src/cleaners/skyblock/slayers.ts
+++ b/src/cleaners/skyblock/slayers.ts
@@ -48,10 +48,10 @@ export function cleanSlayers(data: any): SlayerData {
const slayerTiers: SlayerTier[] = []
// we get the level by finding the biggest number in "level_<number>"
- let slayerLevel = Object.keys(slayerDataRaw.claimed_levels)
+ let slayerLevel = slayerDataRaw.claimed_levels ? (Object.keys(slayerDataRaw.claimed_levels)
.filter(k => slayerDataRaw.claimed_levels[k])
.map(n => parseInt(n.replace(/^level_/, '')))
- .sort((a, b) => b - a)[0] ?? 0
+ .sort((a, b) => b - a)[0] ?? 0) : 0
for (const slayerDataKey in slayerDataRaw) {