Skip to content

Commit

Permalink
Improve DialogResult extension
Browse files Browse the repository at this point in the history
Add null check
  • Loading branch information
b-straub committed Jul 1, 2024
1 parent f9e42c6 commit 6b6849d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using MudBlazor;
using System.Diagnostics.CodeAnalysis;
using MudBlazor;

namespace RxMudBlazorLight.Extensions
{
public static class RxMudBlazorLightExtensionsExtern
{
public static bool OK(this DialogResult? result)
public static bool OK([NotNullWhen(true)] this DialogResult? result)
{
return result is not null && !result.Canceled;
}
Expand Down
2 changes: 1 addition & 1 deletion RxMudBlazorLight/RxMudBlazorLight.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<PackageTags>Blazor,MudBlazor,Rx,Reactive</PackageTags>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageOutputPath>..\Nuget</PackageOutputPath>
<PackageVersion>0.9.3</PackageVersion>
<PackageVersion>0.9.4</PackageVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion RxMudBlazorLightTestBase/CRUD/CRUDItemAddOrUpdate.razor
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ else
var dialog = await DialogService.ShowAsync<CRUDItemDialog>(AddMode ? "Add ToDo" : "Edit ToDo", parameters);
var result = await dialog.Result;

if (result is not null && !result.Canceled)
if (result.OK())
{
var scope = (CrudService.CrudItemInput?)result.Data;
if (scope is not null)
Expand Down
2 changes: 1 addition & 1 deletion RxMudBlazorLightTestBase/Components/ButtonTest.razor
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@

var res = await dialog.Result;

if (res is not null && !res.Canceled)
if (res.OK())
{
c.NotifyChanging();
await Task.Delay(4000, c.CancellationToken);
Expand Down

0 comments on commit 6b6849d

Please sign in to comment.