-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[webview_flutter_wkwebview] Fixes crash when sending undefined message via javascript channel #8776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
6abb674
2de63f3
0905d5e
153a85c
1362056
5c7801b
83b1aed
feb84e2
77bec50
db6b43a
ef6ccae
4bde9bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -906,7 +906,7 @@ class WebKitJavaScriptChannelParams extends JavaScriptChannelParams { | |
| return (_, __, WKScriptMessage message) { | ||
| if (weakReference.target != null) { | ||
| weakReference.target!( | ||
| JavaScriptMessage(message: message.body!.toString()), | ||
| JavaScriptMessage(message: message.body?.toString() ?? ''), | ||
|
||
| ); | ||
| } | ||
| }; | ||
|
|
||




There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is misleading example code as written, since
.toStringcan be called onnull; the?? ''part can never execute. You could just remove the!from the previous code.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done