Skip to content

Commit 195ddf7

Browse files
authored
Fix NullRef when JS method has no return value (#44)
The InvokeJsMethodAsync() method now returns null if there was no return value. Fixes #27
1 parent 60bfb52 commit 195ddf7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

HybridWebView/HybridWebView.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ public async Task<string> InvokeJsMethodAsync(string methodName, params object[]
8888
{
8989
var stringResult = await InvokeJsMethodAsync(methodName, paramValues);
9090

91+
if (stringResult is null)
92+
{
93+
return default;
94+
}
9195
return JsonSerializer.Deserialize<TReturnType>(stringResult);
9296
}
9397

0 commit comments

Comments
 (0)