From 53d6374c6ccf77f5704cea6429c9267cf3059315 Mon Sep 17 00:00:00 2001 From: Jerom Venneker Date: Mon, 2 Jun 2025 19:19:13 +0200 Subject: [PATCH] Fixed issue where client crashes when collecting item while offline --- soh/soh/Network/Archipelago/Archipelago.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 }); }