From 444e0b7c467ccb75e8a375cb1208deea78a4df9c Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Tue, 11 Jun 2024 11:13:15 +0800 Subject: [PATCH] Check if PageProgressRef is null --- .../Components/UiPageProgress.razor.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/UiPageProgress.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/UiPageProgress.razor.cs index 8e494cba2f8..ad0f9966543 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/UiPageProgress.razor.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/UiPageProgress.razor.cs @@ -7,7 +7,7 @@ namespace Volo.Abp.BlazoriseUI.Components; public partial class UiPageProgress : ComponentBase, IDisposable { - protected PageProgress PageProgressRef { get; set; } = default!; + protected PageProgress? PageProgressRef { get; set; } protected int? Percentage { get; set; } @@ -33,8 +33,11 @@ private async void OnProgressChanged(object? sender, UiPageProgressEventArgs e) Visible = e.Percentage == null || (e.Percentage >= 0 && e.Percentage <= 100); Color = GetColor(e.Options.Type); - await PageProgressRef.SetValueAsync(e.Percentage); - + if(PageProgressRef != null) + { + await PageProgressRef.SetValueAsync(e.Percentage); + } + await InvokeAsync(StateHasChanged); }