Skip to content

Commit bc668a5

Browse files
authored
Merge pull request #352 from apexcharts/guard-jsobjectref-null
Guard jsObjectReference null
2 parents eefefc6 + e716e3e commit bc668a5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Blazor-ApexCharts/ApexChart.razor.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,8 @@ protected override void OnParametersSet()
363363

364364
private async ValueTask<TValue> InvokeJsAsync<TValue>(string identifier, params object[] args)
365365
{
366+
if(blazor_apexchart == null) { return default; }
367+
366368
try
367369
{
368370
return await blazor_apexchart.InvokeAsync<TValue>(identifier, args);
@@ -372,6 +374,8 @@ private async ValueTask<TValue> InvokeJsAsync<TValue>(string identifier, params
372374

373375
private async ValueTask InvokeVoidJsAsync(string identifier, params object[] args)
374376
{
377+
if (blazor_apexchart == null) { return; }
378+
375379
try
376380
{
377381
if (blazor_apexchart is IJSInProcessObjectReference jsInProcessRuntime)
@@ -1025,7 +1029,7 @@ public virtual void Dispose()
10251029
{
10261030
GC.SuppressFinalize(this);
10271031

1028-
if (Options.Chart?.Id != null && isReady)
1032+
if (Options.Chart?.Id != null && isReady && blazor_apexchart != null)
10291033
{
10301034
try
10311035
{

0 commit comments

Comments
 (0)