Skip to content

Commit

Permalink
Fix an exception when deleting the application's data
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianLeChat committed Jun 25, 2021
1 parent 5002d04 commit 9a1bb6b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,15 @@ private void Form1_Close(object sender, FormClosingEventArgs e)
if (cleanupOnShutDown)
ToastNotificationManagerCompat.Uninstall();

// Then, all saved avatars.
var files = Directory.GetFiles("images");

foreach (var file in files)
// Then, all saved avatars (if the save folder exists).
if (Directory.Exists("images"))
{
File.Delete(file);
var files = Directory.GetFiles("images");

foreach (var file in files)
{
File.Delete(file);
}
}
}

Expand Down

0 comments on commit 9a1bb6b

Please sign in to comment.