Fixed crash when recieving a bounce without any tags
This commit is contained in:
@@ -213,19 +213,21 @@ bool ArchipelagoClient::StartClient() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
apClient->set_bounced_handler([&](const nlohmann::json data) {
|
apClient->set_bounced_handler([&](const nlohmann::json data) {
|
||||||
std::list<std::string> tags = data["tags"];
|
if(data.contains("tags")) {
|
||||||
bool deathLink = (std::find(tags.begin(), tags.end(), "DeathLink") != tags.end());
|
std::list<std::string> tags = data["tags"];
|
||||||
|
bool deathLink = (std::find(tags.begin(), tags.end(), "DeathLink") != tags.end());
|
||||||
|
|
||||||
if (deathLink && data["data"]["source"] != apClient->get_slot()) {
|
if (deathLink && data["data"]["source"] != apClient->get_slot()) {
|
||||||
if (GameInteractor::IsSaveLoaded()) {
|
if (GameInteractor::IsSaveLoaded()) {
|
||||||
gSaveContext.health = 0;
|
gSaveContext.health = 0;
|
||||||
std::string prefixText = std::string(data["data"]["source"]) + " died.";
|
std::string prefixText = std::string(data["data"]["source"]) + " died.";
|
||||||
Notification::Emit({ .prefix = prefixText, .message = "Cause:", .suffix = data["data"]["cause"] });
|
Notification::Emit({ .prefix = prefixText, .message = "Cause:", .suffix = data["data"]["cause"] });
|
||||||
std::string deathLinkMessage = "[LOG] Received death link from " + std::string(data["data"]["source"]) +
|
std::string deathLinkMessage = "[LOG] Received death link from " + std::string(data["data"]["source"]) +
|
||||||
". Cause: " + std::string(data["data"]["cause"]);
|
". Cause: " + std::string(data["data"]["cause"]);
|
||||||
ArchipelagoConsole_SendMessage(deathLinkMessage.c_str());
|
ArchipelagoConsole_SendMessage(deathLinkMessage.c_str());
|
||||||
|
|
||||||
isDeathLinkedDeath = true;
|
isDeathLinkedDeath = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user