From 0bef7fa9a5ab4426fe763f84e9cf01c18a7dd94e Mon Sep 17 00:00:00 2001 From: Adrien Allard Date: Tue, 12 Mar 2019 08:25:18 +0100 Subject: [PATCH] Fixed: Issue where an exception was thrown at start when there was no internet connection. --- Application/FileConverter/Services/UpgradeService.cs | 6 +++--- Application/FileConverter/XmlHelpers.cs | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Application/FileConverter/Services/UpgradeService.cs b/Application/FileConverter/Services/UpgradeService.cs index ef3d316..6407738 100644 --- a/Application/FileConverter/Services/UpgradeService.cs +++ b/Application/FileConverter/Services/UpgradeService.cs @@ -71,13 +71,13 @@ namespace FileConverter.Services Diagnostics.Debug.Log($"Failed to check upgrade: {exception.Message}."); } - if (task == null) + UpgradeVersionDescription versionDescription = await task; + + if (versionDescription == null) { return null; } - UpgradeVersionDescription versionDescription = await task; - Registry.SetValue(Registry.Keys.LastUpdateCheckDate, DateTime.Now.ToFileTime()); if (versionDescription.LatestVersion <= Application.ApplicationVersion) diff --git a/Application/FileConverter/XmlHelpers.cs b/Application/FileConverter/XmlHelpers.cs index 14c1d18..c4c01cd 100644 --- a/Application/FileConverter/XmlHelpers.cs +++ b/Application/FileConverter/XmlHelpers.cs @@ -45,8 +45,7 @@ namespace FileConverter throw; } - IXmlSerializable xmlSerializableObject = deserializedObject as IXmlSerializable; - if (xmlSerializableObject != null) + if (deserializedObject is IXmlSerializable xmlSerializableObject) { xmlSerializableObject.OnDeserializationComplete(); }