Skip to content

Commit

Permalink
Fix issue where null gametype from steam caused error
Browse files Browse the repository at this point in the history
  • Loading branch information
GravityWolfNotAmused committed Jul 22, 2024
1 parent e5a3f67 commit 257e540
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion DiscordPlayerCountBot/Providers/SteamProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ public override DataProvider GetRequiredProviderType()
Map = response.map
};

var serverTime = model.Gametype.Split(",")
if (!model.Gametype?.Contains(',') ?? false)
return model;

var serverTime = model.Gametype?.Split(",")
.Where(entry => entry.Contains(':') && entry.Length == 5)
.FirstOrDefault();

Expand Down
2 changes: 1 addition & 1 deletion DiscordPlayerCountBot/ViewModels/Steam/SteamViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public class SteamViewModel : BaseViewModel
{
public string Map { get; set; }
public string Gametype { get; set; }
public string? Gametype { get; set; }
public string Time { get; set; }
public string SunMoon { get; set; }
}
Expand Down

0 comments on commit 257e540

Please sign in to comment.