From 1c0db7e58a7d19b96be7a901a7b01aee43930df6 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sun, 8 Nov 2020 18:08:02 +0100 Subject: [PATCH] Fix crash on incorrect authentication token (#336) Fix client.js exiting abruptly when the getID endpoint returns something other than a string as the body, this happens on authentication failure. --- client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client.js b/client.js index 1c445ff0..4cf055ad 100644 --- a/client.js +++ b/client.js @@ -716,7 +716,7 @@ async function instanceManagement(instanceconfig) { console.error(err); } else if (response && response.body) { // In the future we might be interested in whether or not we actually manage to send it, but honestly I don't care. - if (response.body.toLowerCase() !== "ok") { + if (typeof response.body !== "string" || response.body.toLowerCase() !== "ok") { console.log("Got no \"ok\" while registering our precense with master "+config.masterIP+" at " + payload.time); console.log(response.body); }