!798 fix(#I2AMFB): throw NullReferenceException when enable Table AutoRefresh feature in debug mode

* fix: AutoRefreshCacheTokenSource is null
This commit is contained in:
Argo 2020-12-24 00:08:58 +08:00
parent 9d0de5675f
commit b1f19f2531

View File

@ -297,7 +297,7 @@ namespace BootstrapBlazor.Components
// 自动刷新功能
_ = Task.Run(async () =>
{
while (!AutoRefreshCancelTokenSource.IsCancellationRequested)
while (!(AutoRefreshCancelTokenSource?.IsCancellationRequested ?? true))
{
await InvokeAsync(QueryAsync);
await Task.Delay(AutoRefreshInterval, AutoRefreshCancelTokenSource.Token);
@ -395,6 +395,7 @@ namespace BootstrapBlazor.Components
{
if (disposing)
{
AutoRefreshCancelTokenSource?.Cancel();
AutoRefreshCancelTokenSource?.Dispose();
AutoRefreshCancelTokenSource = null;
}