Skip to content

Commit

Permalink
Fix NullRef when JS method has no return value
Browse files Browse the repository at this point in the history
The InvokeJsMethodAsync() method now returns null if there was no return value.

Fixes #27
  • Loading branch information
Eilon committed Feb 10, 2024
1 parent 60bfb52 commit a77e13b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions HybridWebView/HybridWebView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ public async Task<string> InvokeJsMethodAsync(string methodName, params object[]
{
var stringResult = await InvokeJsMethodAsync(methodName, paramValues);

if (stringResult is null)
{
return default;
}
return JsonSerializer.Deserialize<TReturnType>(stringResult);
}

Expand Down

0 comments on commit a77e13b

Please sign in to comment.