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.
This commit is contained in:
Hornwitser authored and GitHub committed 2020-11-08 18:08:02 +01:00
1 parent 3d8cfef8bc
commit 1c0db7e58a
1 file changed
+1 -1
+1 -1
View File
@@ -716,7 +716,7 @@ async function instanceManagement(instanceconfig) {
console.error(err); console.error(err);
} else if (response && response.body) { } 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. // 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("Got no \"ok\" while registering our precense with master "+config.masterIP+" at " + payload.time);
console.log(response.body); console.log(response.body);
} }