[Discord]: Add checks for nullptr pointers to be sure (#764)
This commit is contained in:
parent
1df88ea35d
commit
ee078303eb
@ -65,7 +65,7 @@ namespace Components
|
|||||||
{
|
{
|
||||||
const auto* value = Game::StringTable_GetColumnValueForRow(table, row, 1);
|
const auto* value = Game::StringTable_GetColumnValueForRow(table, row, 1);
|
||||||
const auto* localize = Game::DB_FindXAssetHeader(Game::ASSET_TYPE_LOCALIZE_ENTRY, value).localize;
|
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
|
else
|
||||||
{
|
{
|
||||||
@ -91,7 +91,7 @@ namespace Components
|
|||||||
|
|
||||||
DiscordPresence.partyId = Utils::String::VA("%zu", hashFn(address) ^ GetDiscordNonce());
|
DiscordPresence.partyId = Utils::String::VA("%zu", hashFn(address) ^ GetDiscordNonce());
|
||||||
DiscordPresence.joinSecret = address.getCString();
|
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();
|
DiscordPresence.partyMax = Party::GetMaxClients();
|
||||||
|
|
||||||
if (!DiscordPresence.startTimestamp)
|
if (!DiscordPresence.startTimestamp)
|
||||||
|
Loading…
Reference in New Issue
Block a user