Skip to content

Commit 8d907e2

Browse files
committed
[FlashpointManager] Fix crash when trying to delete nonexistent file
1 parent 2ea0b35 commit 8d907e2

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

FlashpointManager/src/Common.cs

+9-6
Original file line numberDiff line numberDiff line change
@@ -443,14 +443,17 @@ public static void DeleteFileAndDirectories(string file)
443443
{
444444
File.Delete(file);
445445
}
446-
catch (Exception e) when (!(e is DirectoryNotFoundException))
446+
catch (Exception e)
447447
{
448-
GenericError(
449-
"Failed to delete the following file:\n" + file + "\n\n" +
450-
"Make sure it is not open or being used by another program."
451-
);
448+
if (!(e is DirectoryNotFoundException))
449+
{
450+
GenericError(
451+
"Failed to delete the following file:\n" + file + "\n\n" +
452+
"Make sure it is not open or being used by another program."
453+
);
452454

453-
return;
455+
return;
456+
}
454457
}
455458

456459
string folder = Path.GetDirectoryName(file);

0 commit comments

Comments
 (0)