Skip to content

Commit

Permalink
Fix NullRef when JS method has no return value (#44)
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 authored Feb 11, 2024
1 parent 60bfb52 commit 195ddf7
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 195ddf7

Please sign in to comment.