diff --git a/soh/soh/Network/Archipelago/Archipelago.cpp b/soh/soh/Network/Archipelago/Archipelago.cpp index 3efc029c3..4b9abb94f 100644 --- a/soh/soh/Network/Archipelago/Archipelago.cpp +++ b/soh/soh/Network/Archipelago/Archipelago.cpp @@ -278,6 +278,10 @@ void ArchipelagoClient::QueueExternalCheck(const int64_t apLocation) { } bool ArchipelagoClient::IsConnected() { + if(apClient == nullptr) { + return false; + } + return apClient->get_state() == APClient::State::SLOT_CONNECTED; } @@ -287,6 +291,10 @@ void ArchipelagoClient::CheckLocation(RandomizerCheck sohCheckId) { return; } + if(!IsConnected()) { + return; + } + std::string apName = Rando::StaticData::GetLocation(sohCheckId)->GetName(); if (apName.empty()) { return; @@ -296,9 +304,6 @@ void ArchipelagoClient::CheckLocation(RandomizerCheck sohCheckId) { std::string logMessage = "[LOG] Checked: " + apName + "(" + std::to_string(apItemId) + "), sending to AP server"; ArchipelagoConsole_SendMessage(logMessage.c_str(), true); - if(!IsConnected()) { - return; - } apClient->LocationChecks({ apItemId }); }