From 751120e77e88021d74ce6759640e9c825a752878 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Wed, 15 May 2024 01:42:36 -0400 Subject: [PATCH] Fix crashing in offline mode --- src/account.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/account.ts b/src/account.ts index 0d79f4d55..357cd5af4 100644 --- a/src/account.ts +++ b/src/account.ts @@ -12,6 +12,7 @@ export const clientSessionId = Utils.randomString(32); export function updateUserInfo(): Promise<[boolean, integer]> { return new Promise<[boolean, integer]>(resolve => { if (bypassLogin) { + loggedInUser = { username: 'Guest', lastSessionSlot: -1 }; let lastSessionSlot = -1; for (let s = 0; s < 2; s++) { if (localStorage.getItem(`sessionData${s ? s : ''}_${loggedInUser.username}`)) { @@ -19,7 +20,7 @@ export function updateUserInfo(): Promise<[boolean, integer]> { break; } } - loggedInUser = { username: 'Guest', lastSessionSlot: lastSessionSlot }; + loggedInUser.lastSessionSlot = lastSessionSlot; return resolve([ true, 200 ]); } Utils.apiFetch('account/info', true).then(response => {