From de4f176cf7de3eb18d9c2875df389c3a70662a98 Mon Sep 17 00:00:00 2001 From: AndnixSH <40742924+AndnixSH@users.noreply.github.com> Date: Sat, 16 Sep 2023 14:58:09 +0200 Subject: [PATCH] Fix crash when drag and dropping APK file --- APKToolGUI/Forms/FormMain.cs | 2 +- APKToolGUI/Utils/DragDropUtils.cs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/APKToolGUI/Forms/FormMain.cs b/APKToolGUI/Forms/FormMain.cs index 1705c19..386491e 100644 --- a/APKToolGUI/Forms/FormMain.cs +++ b/APKToolGUI/Forms/FormMain.cs @@ -248,7 +248,7 @@ internal async Task GetApkInfo(string file) try { string splitPath = Path.Combine(Program.TEMP_PATH, "SplitInfo"); - string arch = null; + string arch = ""; await Task.Factory.StartNew(() => { diff --git a/APKToolGUI/Utils/DragDropUtils.cs b/APKToolGUI/Utils/DragDropUtils.cs index f5b63a7..9e12f82 100644 --- a/APKToolGUI/Utils/DragDropUtils.cs +++ b/APKToolGUI/Utils/DragDropUtils.cs @@ -3,6 +3,7 @@ using System.IO; using System.Linq; using System.Windows.Forms; +using System.Windows.Markup; namespace SaveToGameWpf.Logic.Utils { @@ -39,7 +40,7 @@ public static void CheckDragEnter(this DragEventArgs e, params string[] extensio string[] files = e.GetFilesDrop(); if (extensions == null && Directory.Exists(files[0])) e.Effect = DragDropEffects.Copy; - else if (extensions.Any(ext => files[0].EndsWith(ext, StringComparison.Ordinal))) + else if (extensions != null && extensions.Any(ext => files[0].EndsWith(ext, StringComparison.Ordinal))) e.Effect = DragDropEffects.Copy; else e.Effect = DragDropEffects.None; @@ -73,7 +74,7 @@ public static bool CheckManyDragOver(this DragEventArgs e, params string[] exten e.Effect = DragDropEffects.Move; return true; } - else if (extensions.Any(ext => files[0].EndsWith(ext, StringComparison.Ordinal))) + else if (extensions != null && extensions.Any(ext => files[0].EndsWith(ext, StringComparison.Ordinal))) { e.Effect = DragDropEffects.Move; return true;