Fixed issue where client crashes when collecting item while offline
This commit is contained in:
@@ -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 });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user