Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 5680820

Browse files
author
Ian Macphail
committed
[[ bug 22689 ]] Return empty string if JS function call has no return value
This patch fixes a bug in libbrowser where null would be returned when evaluating a JavaScript statement with no result value. The empty string will be returned instead.
1 parent 91afa36 commit 5680820

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libbrowser/src/libbrowser_wkwebview.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -991,8 +991,8 @@ void _SyncEvaluateJavaScript(WKWebView *p_view, NSString *p_javascript, id &r_re
991991

992992
if (t_result == nil)
993993
{
994-
r_result = nil;
995-
return true;
994+
// return the empty string if there is no result value
995+
return MCCStringClone("", r_result);
996996
}
997997

998998
NSString *t_result_string = [NSString stringWithFormat:@"%@", t_result];

0 commit comments

Comments
 (0)