diff options
-rw-r--r-- | indra/newview/llappviewer.cpp | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index fee2a742f5..16e2027af1 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -5933,10 +5933,14 @@ void LLAppViewer::initDiscordSocial() }); if (gSavedSettings.getBOOL("EnableDiscord")) { - gDiscordClient->UpdateToken(discordpp::AuthorizationTokenType::Bearer, gSecAPIHandler->loadCredential("Discord")->getAuthenticator()["token"].asString(), [](discordpp::ClientResult result) { - if (result.Successful()) - gDiscordClient->Connect(); - }); + auto credential = gSecAPIHandler->loadCredential("Discord"); + if (credential.notNull()) + { + gDiscordClient->UpdateToken(discordpp::AuthorizationTokenType::Bearer, credential->getAuthenticator()["token"].asString(), [](discordpp::ClientResult result) { + if (result.Successful()) + gDiscordClient->Connect(); + }); + } } } @@ -5971,12 +5975,18 @@ void LLAppViewer::handleDiscordSocial(const LLSD& value) } else { - gDiscordClient->RevokeToken(APPLICATION_ID, gSecAPIHandler->loadCredential("Discord")->getAuthenticator()["token"].asString(), [](discordpp::ClientResult result) { - if (result.Successful()) - gDiscordClient->Disconnect(); - auto cred = new LLCredential("Discord"); - gSecAPIHandler->deleteCredential(cred); - }); + auto credential = gSecAPIHandler->loadCredential("Discord"); + if (credential.notNull()) + { + gDiscordClient->RevokeToken(APPLICATION_ID, credential->getAuthenticator()["token"].asString(), [](discordpp::ClientResult result) { + if (result.Successful()) + { + gDiscordClient->Disconnect(); + } + auto cred = new LLCredential("Discord"); + gSecAPIHandler->deleteCredential(cred); + }); + } } } |