Local version check: Avoid exception if file doesn't exist

This commit is contained in:
N00MKRAD
2024-08-13 10:32:01 +02:00
parent b520d7212d
commit 2505d6ec11

View File

@@ -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)
{