Skip to content

Commit 3538f04

Browse files
committed
fix(grabber): access member of null when processing vanilla server data
1 parent 114cd88 commit 3538f04

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

utils.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,12 @@ module.exports = class Utils {
133133
if (nbt.select('').select('Spigot.ticksLived')) {
134134
lived = nbt.select('').select('Spigot.ticksLived').getValue() / 20
135135
}
136-
const timeStart = bignum(nbt.select('').select('bukkit').select('firstPlayed').getValue()).toNumber()
137-
const timeLast = bignum(nbt.select('').select('bukkit').select('lastPlayed').getValue()).toNumber()
136+
const timeStart = nbt.select('').select('bukkit')
137+
? bignum(nbt.select('').select('bukkit').select('firstPlayed').getValue()).toNumber()
138+
: null
139+
const timeLast = nbt.select('').select('bukkit')
140+
? bignum(nbt.select('').select('bukkit').select('lastPlayed').getValue()).toNumber()
141+
: null
138142
const pdata = {
139143
seen: timeLast,
140144
time_start: timeStart,

0 commit comments

Comments
 (0)