diff --git a/StatsDisplay/FullStatsWindow.xaml.cs b/StatsDisplay/FullStatsWindow.xaml.cs index eb26781..cb7c672 100644 --- a/StatsDisplay/FullStatsWindow.xaml.cs +++ b/StatsDisplay/FullStatsWindow.xaml.cs @@ -22,7 +22,7 @@ public partial class FullStatsWindow : HeroesWindow public FullStatsWindow() { InitializeComponent(); - playersTable.ItemsSource = game.Players.OrderBy(p => (game.Me?.Team == 0 ? 1 : -1) * p.Team); // My team is always on top + playersTable.ItemsSource = game.Players.OrderBy(p => ((game.Me?.Team ?? 0) == 0 ? 1 : -1) * p.Team); // My team is always on top } } } diff --git a/StatsDisplay/Helpers/MmrValueConverter.cs b/StatsDisplay/Helpers/MmrValueConverter.cs index b513d36..35d4914 100644 --- a/StatsDisplay/Helpers/MmrValueConverter.cs +++ b/StatsDisplay/Helpers/MmrValueConverter.cs @@ -7,11 +7,11 @@ namespace StatsDisplay { // There is no way to use bindings as array indexers in WPF so we have to create a converter - public class MmrValueConverter : GenericValueConverter, int> + public class MmrValueConverter : GenericValueConverter, int?> { - protected override int Convert(Dictionary value) + protected override int? Convert(Dictionary value) { - return value[Properties.Settings.Default.MmrDisplayMode].Mmr; + return value[Properties.Settings.Default.MmrDisplayMode]?.Mmr; } } } diff --git a/StatsFetcher/FileProcessor.cs b/StatsFetcher/FileProcessor.cs index 298dac0..951121e 100644 --- a/StatsFetcher/FileProcessor.cs +++ b/StatsFetcher/FileProcessor.cs @@ -83,7 +83,7 @@ public static void ExtractFullData(Game game) { foreach (var p in game.Players) { if (p.HotsLogsProfile == null) - return; + continue; // who wants to look at some dirty html parsing? try { p.MapWinRate = float.Parse(p.HotsLogsProfile.GetElementbyId("mapStatistics").SelectSingleNode($".//tr/td[text()='{game.Map}']").SelectSingleNode("./../td[last()]").InnerText.Replace("%", "")); diff --git a/StatsFetcher/PlayerProfile.cs b/StatsFetcher/PlayerProfile.cs index c5e49a7..f882715 100644 --- a/StatsFetcher/PlayerProfile.cs +++ b/StatsFetcher/PlayerProfile.cs @@ -40,7 +40,7 @@ public PlayerProfile(Game game, string battleTag, Region region) // using this properties greatly simplifies style bingings in gui public bool IsMe { get { return Game.Me == this; } } - public bool IsMyTeam { get { return Game.Me?.Team == Team; } } + public bool IsMyTeam { get { return (Game.Me?.Team ?? 0) == Team; } } public event PropertyChangedEventHandler PropertyChanged; public void TriggerPropertyChanged()