[Discord]: Add checks for nullptr pointers to be sure (#764)

This commit is contained in:
Edo 2023-02-09 14:30:31 +00:00 committed by GitHub
parent 1df88ea35d
commit ee078303eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -65,7 +65,7 @@ namespace Components
{
const auto* value = Game::StringTable_GetColumnValueForRow(table, row, 1);
const auto* localize = Game::DB_FindXAssetHeader(Game::ASSET_TYPE_LOCALIZE_ENTRY, value).localize;
DiscordPresence.details = Utils::String::Format("{} on {}", localize->value, map);
DiscordPresence.details = Utils::String::Format("{} on {}", localize ? localize->value : "Team Deathmatch", map);
}
else
{
@ -91,7 +91,7 @@ namespace Components
DiscordPresence.partyId = Utils::String::VA("%zu", hashFn(address) ^ GetDiscordNonce());
DiscordPresence.joinSecret = address.getCString();
DiscordPresence.partySize = Game::cgArray[0].snap->numClients;
DiscordPresence.partySize = Game::cgArray[0].snap ? Game::cgArray[0].snap->numClients : 1;
DiscordPresence.partyMax = Party::GetMaxClients();
if (!DiscordPresence.startTimestamp)