From 5b8536c250c2208c69faa355995b8cd825a91d4e Mon Sep 17 00:00:00 2001 From: lluiscab Date: Thu, 23 Aug 2018 17:21:23 +0200 Subject: [PATCH] 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. --- src/client/autoVersion.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/autoVersion.js b/src/client/autoVersion.js index 236d6e2..026196e 100644 --- a/src/client/autoVersion.js +++ b/src/client/autoVersion.js @@ -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