fix #getNextProtocolVersion crash from Bedrock having undefined versions

This commit is contained in:
Nick Krecklow 2020-04-21 18:02:29 -05:00
parent 4d13965e6b
commit ef2f2bd204
No known key found for this signature in database
GPG Key ID: 5F149FDE156FFA94

@ -249,6 +249,13 @@ class ServerRegistration {
}
getNextProtocolVersion () {
// Minecraft Bedrock Edition does not have protocol versions
if (this.data.type === 'PE') {
return {
protocolId: 0,
protocolIndex: 0
}
}
const protocolVersions = minecraftVersions[this.data.type]
if (typeof this._nextProtocolIndex === 'undefined' || this._nextProtocolIndex + 1 >= protocolVersions.length) {
this._nextProtocolIndex = 0