Improve protections around lastReadWhatsNew

This commit is contained in:
John Lewin 2018-06-05 17:54:19 -07:00
parent 19fb79769a
commit 64fbf007b7

View file

@ -119,9 +119,14 @@ namespace MatterHackers.MatterControl
DateTime installTime = new FileInfo(filePath).LastWriteTime;
var lastReadWhatsNew = UserSettings.Instance.get(UserSettingsKey.LastReadWhatsNew);
DateTime whatsNewReadTime = installTime;
if (lastReadWhatsNew != null)
if (!string.IsNullOrWhiteSpace(lastReadWhatsNew))
{
whatsNewReadTime = JsonConvert.DeserializeObject<DateTime>(lastReadWhatsNew);
try
{
whatsNewReadTime = JsonConvert.DeserializeObject<DateTime>(lastReadWhatsNew);
}
catch { }
}
return whatsNewReadTime > installTime;