Skip to content

Commit

Permalink
Bootstrap.WinForms: Catch exceptions when checking if directory is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianeicher committed Jun 26, 2023
1 parent 14d1abf commit 4c0271a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Bootstrap.WinForms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,16 @@ bool PathIsIn(Environment.SpecialFolder folder)
Msg.Inform(this, string.Format(LocalizableStrings.FolderNotNtfs, path), MsgSeverity.Warn);
return false;
}

return Directory.GetFileSystemEntries(path).Length == 0
|| Msg.OkCancel(this, string.Format(LocalizableStrings.FolderNotEmpty, path), MsgSeverity.Warn, LocalizableStrings.UseAnyway, LocalizableStrings.ChooseDifferent);
}
catch (Exception ex)
{
Log.Error(ex);
Msg.Inform(this, ex.Message, MsgSeverity.Error);
return false;
}

return Directory.GetFileSystemEntries(path).Length == 0
|| Msg.OkCancel(this, string.Format(LocalizableStrings.FolderNotEmpty, path), MsgSeverity.Warn, LocalizableStrings.UseAnyway, LocalizableStrings.ChooseDifferent);
}

private void buttonContinue_Click(object sender, EventArgs e)
Expand Down

0 comments on commit 4c0271a

Please sign in to comment.