Fixed issue where client crashes when collecting item while offline

This commit is contained in:
Jerom Venneker
2025-06-02 19:19:13 +02:00
parent b6990d92bf
commit 53d6374c6c

View File

@@ -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 });
}