Skip to content

Commit

Permalink
Fix crash when loading cache from a previous version
Browse files Browse the repository at this point in the history
  • Loading branch information
pipe01 committed Mar 19, 2019
1 parent 8caaba5 commit 2a3fb9a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Legendary Rune Maker/Data/WebCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,15 @@ public static void Init()
lock (WriteLock)
text = Encoding.UTF8.GetString(Convert.FromBase64String(File.ReadAllText(CachePath)));

Data = JsonConvert.DeserializeObject<CacheData>(text, JsonSettings);
try
{
Data = JsonConvert.DeserializeObject<CacheData>(text, JsonSettings);
}
catch (JsonSerializationException ex)
{
LogTo.ErrorException("Failed to load web cache file", ex);
Data = new CacheData();
}
}
}

Expand Down

0 comments on commit 2a3fb9a

Please sign in to comment.