Fix a crash when updating the DiscordPresence party size

This commit is contained in:
abcdefg30
2020-08-23 13:38:00 +02:00
committed by teinarss
parent 183ece1360
commit 1a77f7320b
2 changed files with 18 additions and 1 deletions

View File

@@ -169,6 +169,22 @@ namespace OpenRA.Mods.Common
currentState = state;
}
void UpdateParty(int players, int slots)
{
if (client.CurrentPresence.Party != null)
{
client.UpdatePartySize(players, slots);
return;
}
client.UpdateParty(new Party
{
ID = Secrets.CreateFriendlySecret(new Random()),
Size = players,
Max = slots
});
}
public void Dispose()
{
if (client != null)
@@ -186,7 +202,7 @@ namespace OpenRA.Mods.Common
public static void UpdatePlayers(int players, int slots)
{
Service?.client.UpdatePartySize(players, slots);
Service?.UpdateParty(players, slots);
}
public static void UpdateDetails(string details)