Browse Source

Merge branch 'master' into better-40x-handling

Krzysztof Krysiński 1 week ago
parent
commit
33c0814ffd

+ 1 - 1
src/Drawie

@@ -1 +1 @@
-Subproject commit fa8a969891227f91f25f5444be9ad47aab352782
+Subproject commit 9e5f6dc3ab03cd67fa157b0952e7bb510c465e8b

+ 7 - 1
src/PixiEditor/Models/IO/CustomDocumentFormats/FontDocumentBuilder.cs

@@ -14,7 +14,13 @@ internal class FontDocumentBuilder : IDocumentBuilder
 
     public void Build(DocumentViewModelBuilder builder, string path)
     {
-        Font font = Font.FromFontFamily(new FontFamilyName(new Uri(path), Path.GetFileNameWithoutExtension(path)));
+        Font? font = Font.FromFontFamily(new FontFamilyName(new Uri(path), Path.GetFileNameWithoutExtension(path)));
+
+        if (font is null)
+        {
+            throw new Exception("Failed to load font");
+        }
+
         font.Size = 12;
 
         List<char> glyphs = new();

+ 19 - 3
src/PixiEditor/ViewModels/SubViewModels/UpdateViewModel.cs

@@ -3,6 +3,7 @@ using System.ComponentModel;
 using System.Diagnostics;
 using System.IO;
 using System.Linq;
+using System.Net.Sockets;
 using System.Reflection;
 using System.Text;
 using System.Threading.Tasks;
@@ -212,9 +213,24 @@ internal class UpdateViewModel : SubViewModel<ViewModelMain>
 
     public async Task Download()
     {
-        bool updateCompatible = await UpdateChecker.IsUpdateCompatible();
-        bool updateFileDoesNotExists = !AutoUpdateFileExists();
-        bool updateExeDoesNotExists = !UpdateInstallerFileExists();
+        bool updateCompatible, updateFileDoesNotExists, updateExeDoesNotExists;
+        try
+        {
+            updateCompatible = await UpdateChecker.IsUpdateCompatible();
+            updateFileDoesNotExists = !AutoUpdateFileExists();
+            updateExeDoesNotExists = !UpdateInstallerFileExists();
+        }
+        catch (Exception ex)
+        {
+            UpdateState = UpdateState.UnableToCheck;
+            if (ex is not IOException && ex is not SocketException)
+            {
+                CrashHelper.SendExceptionInfo(ex);
+            }
+
+            return;
+        }
+
 
         if (!updateExeDoesNotExists || !updateFileDoesNotExists)
         {