Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

Commit

Permalink
discordnet: don't start discord if not detected
Browse files Browse the repository at this point in the history
  • Loading branch information
gyf304 committed Feb 2, 2021
1 parent 010a67e commit 5a43886
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/discordnet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,15 @@ void DiscordNet::run()
discord::User user;
discord::Core *_core{};
std::shared_ptr<discord::Core> core;
auto result = discord::Core::Create(DISCORD_APP_ID, DiscordCreateFlags_Default, &_core);
core.reset(_core);
if (!core)
{
auto result = discord::Core::Create(DISCORD_APP_ID, DiscordCreateFlags_NoRequireDiscord, &_core);
if (result != discord::Result::Ok) {
mutex.lock();
exception = std::runtime_error("Cannot instantiate discord service");
exception = std::runtime_error("Cannot instantiate discord service. Make sure discord is running.");
mutex.unlock();
interrupted = true;
return;
}
core.reset(_core);

auto &lm = core->LobbyManager();
auto &um = core->UserManager();
Expand Down

0 comments on commit 5a43886

Please sign in to comment.