Skip to content

Commit

Permalink
fix GetClassColor for invalid/empty class name (HearthSim#1671)
Browse files Browse the repository at this point in the history
  • Loading branch information
Epix37 committed Oct 29, 2015
1 parent aa9afcd commit c4a71a9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Hearthstone Deck Tracker/Utility/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,8 @@ public static double GetScaledXPos(double left, int width, double ratio)

public static System.Windows.Media.Color GetClassColor(string className, bool priestAsGray)
{
if(string.IsNullOrEmpty(className))
return Colors.DimGray;
string color;
if(Config.Instance.ClassColorScheme == ClassColorScheme.HearthStats)
HearthStatsClassColors.TryGetValue(className, out color);
Expand All @@ -783,6 +785,8 @@ public static System.Windows.Media.Color GetClassColor(string className, bool pr
if(!ClassicClassColors.TryGetValue(className, out color))
color = "#808080";
}
if(string.IsNullOrEmpty(color))
return Colors.DimGray;
return (System.Windows.Media.Color)ColorConverter.ConvertFromString(color);
}
public static MetroWindow GetParentWindow(DependencyObject current)
Expand Down

0 comments on commit c4a71a9

Please sign in to comment.