Skip to content

Commit f74710b

Browse files
author
Justin
committed
Fixed bug with null reference in league data.
1 parent 805fc2d commit f74710b

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

src/SourceSchemaParser.Net45/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("2.0.0.0")]
36-
[assembly: AssemblyFileVersion("2.0.0.0")]
35+
[assembly: AssemblyVersion("2.0.1.0")]
36+
[assembly: AssemblyFileVersion("2.0.1.0")]

src/SourceSchemaParser/SchemaFactory.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,22 @@ private static IReadOnlyCollection<DotaLeague> GetDotaLeagues(IReadOnlyCollectio
178178

179179
private static void ReplaceTokensWithLocalizedValues(IReadOnlyCollection<DotaSchemaItem> leagues, IDictionary<string, string> tokens)
180180
{
181+
if(leagues == null || tokens == null || tokens.Count == 0)
182+
{
183+
return;
184+
}
185+
181186
foreach (var league in leagues)
182187
{
183-
league.ItemName = GetLanguageToken(league.ItemName.Remove(0, 1), tokens);
184-
league.ItemDescription = GetLanguageToken(league.ItemDescription.Remove(0, 1), tokens);
185-
if (!String.IsNullOrEmpty(league.ItemTypeName))
188+
if (!string.IsNullOrWhiteSpace(league.ItemName))
189+
{
190+
league.ItemName = GetLanguageToken(league.ItemName.Remove(0, 1), tokens);
191+
}
192+
if (!string.IsNullOrWhiteSpace(league.ItemDescription))
193+
{
194+
league.ItemDescription = GetLanguageToken(league.ItemDescription.Remove(0, 1), tokens);
195+
}
196+
if (!string.IsNullOrEmpty(league.ItemTypeName))
186197
{
187198
league.ItemTypeName = GetLanguageToken(league.ItemTypeName.Remove(0, 1), tokens);
188199
}

0 commit comments

Comments
 (0)