Skip to content

Commit

Permalink
Merge pull request #675 from minaLogi/main
Browse files Browse the repository at this point in the history
プロジェクトの名前の設定時、Ctrl+Zでスタックトレースが表示されないようにし、名前が空白の場合に「無効な文字列です」と表示するようにした。
  • Loading branch information
yuto-trd authored Aug 27, 2023
2 parents 91beede + 355209a commit 1a52819
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/Beutl/ViewModels/Dialogs/CreateNewProjectViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ public CreateNewProjectViewModel()

Name.SetValidateNotifyError(n =>
{
if (Directory.Exists(Path.Combine(Location.Value, n)))
if(n == string.Empty || n == null)
{
return Message.InvalidString;
}
else if (Directory.Exists(Path.Combine(Location.Value, n)))
{
return Message.ItAlreadyExists;
}
Expand Down Expand Up @@ -64,11 +68,15 @@ public CreateNewProjectViewModel()
{
(string name, string location, PixelSize size, int framerate, int samplerate) = t;
return !Directory.Exists(Path.Combine(location, name)) &&
size.Width > 0 &&
size.Height > 0 &&
framerate > 0 &&
samplerate > 0;
if (location != null && name != null)
{
return !Directory.Exists(Path.Combine(location, name)) &&
size.Width > 0 &&
size.Height > 0 &&
framerate > 0 &&
samplerate > 0;
}
else return false;
})
.ToReadOnlyReactivePropertySlim();
Create = new ReactiveCommand(CanCreate);
Expand Down

0 comments on commit 1a52819

Please sign in to comment.