From 5a43886cc8ba9dd7dbd3a9f26e195ff8c2612d30 Mon Sep 17 00:00:00 2001 From: Yifan Gu Date: Tue, 2 Feb 2021 15:28:06 -0500 Subject: [PATCH] discordnet: don't start discord if not detected --- src/discordnet.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/discordnet.cpp b/src/discordnet.cpp index 651f6a1..246a5e9 100644 --- a/src/discordnet.cpp +++ b/src/discordnet.cpp @@ -52,16 +52,15 @@ void DiscordNet::run() discord::User user; discord::Core *_core{}; std::shared_ptr 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();