Fix autoVersion

Simple fix for autoVersion, ends the execution of the `ping` callback if an error is found.
Prevents more errors from getting logged to the console if the server is not reachable.
This commit is contained in:
lluiscab 2018-08-23 17:21:23 +02:00 committed by GitHub
parent 81b94f95ca
commit 5b8536c250
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,7 @@ module.exports = function (client, options) {
debug('pinging', options.host)
// TODO: use 0xfe ping instead for better compatibility/performance? https://github.com/deathcap/node-minecraft-ping
ping(options, function (err, response) {
if (err) { client.emit('error', err) }
if (err) { return client.emit('error', err) }
debug('ping response', response)
// TODO: could also use ping pre-connect to save description, type, max players, etc.
const motd = response.description