From 2505d6ec11cbd4b4955dd17460403a9a93119add Mon Sep 17 00:00:00 2001 From: N00MKRAD <61149547+n00mkrad@users.noreply.github.com> Date: Tue, 13 Aug 2024 10:32:01 +0200 Subject: [PATCH] Local version check: Avoid exception if file doesn't exist --- CodeLegacy/Os/Updater.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CodeLegacy/Os/Updater.cs b/CodeLegacy/Os/Updater.cs index f770c77..5c0ca6d 100644 --- a/CodeLegacy/Os/Updater.cs +++ b/CodeLegacy/Os/Updater.cs @@ -4,6 +4,7 @@ using Flowframes.IO; using Flowframes.Ui; using System; using System.IO; +using System.Linq; using System.Net; using System.Threading.Tasks; using System.Windows.Forms; @@ -26,8 +27,12 @@ namespace Flowframes.Os { try { - string verStr = IoUtils.ReadLines(Paths.GetVerPath())[0]; - return new Version(verStr); + var verLines = IoUtils.ReadLines(Paths.GetVerPath()); + + if(!verLines.Where(s => s.IsNotEmpty()).Any()) + return new Version(0, 0, 0); + + return new Version(verLines.First()); } catch (Exception e) {