Fix microsoft auth error condition handling (#925)

nullish operator can return undefined which causes `if` to not trigger in profile check
This commit is contained in:
extremeheat 2021-11-22 18:37:19 -05:00 committed by GitHub
parent d0a504f5db
commit 9501694f23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,8 +23,8 @@ async function authenticate (client, options) {
debug('[mc] entitlements', entitlements)
debug('[mc] profile', profile)
if (!entitlements?.items) throw Error(`Signed in account ${options.username} doesn't appear to own Minecraft`)
if (profile?.error) throw Error(`Failed to obtain profile data for ${options.username}, does the account own minecraft?`)
if (!entitlements.items?.length) throw Error(`Signed in account ${options.username} doesn't appear to own Minecraft`)
if (!profile || profile.error) throw Error(`Failed to obtain profile data for ${options.username}, does the account own minecraft?`)
options.haveCredentials = token !== null