From bcbcf5ef7f1e7c2209b3b1f17bd8a2fec1c9ac87 Mon Sep 17 00:00:00 2001 From: Frase Date: Sat, 22 Nov 2014 21:01:59 +0800 Subject: [PATCH] Update yggdrasil.js to fix bug This fixes a crash that occurs on line 310 of index.js where it tries to read the value of client.session.selectedProfile.id which doesn't exist if the session was acquired by a refresh with old auth details. --- lib/yggdrasil.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/yggdrasil.js b/lib/yggdrasil.js index 3b34a17..9b3ac86 100644 --- a/lib/yggdrasil.js +++ b/lib/yggdrasil.js @@ -20,7 +20,8 @@ function getSession(username, password, clientToken, refresh, cb) { var session = { accessToken: resp.body.accessToken, clientToken: resp.body.clientToken, - username: resp.body.selectedProfile.name + username: resp.body.selectedProfile.name, + selectedProfile: resp.body.selectedProfile }; cb(null, session); } else { @@ -100,4 +101,4 @@ exports.getSession = getSession; exports.joinServer = joinServer; exports.validateSession = validateSession; exports.generateUUID = require("node-uuid").v4; -exports.loginType = "yggdrasil"; \ No newline at end of file +exports.loginType = "yggdrasil";