From 52fe954e25690ebe50be012f010ff22f3ab8db45 Mon Sep 17 00:00:00 2001 From: Ray Date: Fri, 19 Jul 2024 22:18:17 +0100 Subject: [PATCH] Fixed handle bad icon when saving --- MainForm.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/MainForm.cs b/MainForm.cs index a73b83e..a5f98ee 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -654,6 +654,11 @@ namespace FizzyLauncher case ".jsnx": this.CurrentSession = await RyzStudio.IO.Compression.ZFile.ReadFile(filename, "Document.json"); + if (this.CurrentSession == null) + { + this.CurrentSession = new AppOptions(); + } + // Load icons this.CurrentSession = await LoadIconsFromZipFile(filename, this.CurrentSession); @@ -997,14 +1002,20 @@ namespace FizzyLauncher zipEntry = archive.CreateEntry(key, CompressionLevel.SmallestSize); - using (Stream entryStream = zipEntry.Open()) + try { - using (Image image = item.Icon) + using (Stream entryStream = zipEntry.Open()) { - image.Save(entryStream, ImageFormat.Png); + using (Image image = item.Icon) + { + image.Save(entryStream, ImageFormat.Png); + } } } - + catch (Exception) + { + continue; + } } } }