Skip to content

Commit fa0ca36

Browse files
committed
Merge pull request marcuswestin#55 from bastibense/master
Fix exception if _sendData is called with data == nil
2 parents 7b271e4 + a91f290 commit fa0ca36

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

WebViewJavascriptBridge/WebViewJavascriptBridge.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@ - (void)_sendData:(NSDictionary *)data responseCallback:(WVJBResponseCallback)re
9595
if (!data) {
9696
data = (NSDictionary *)[NSNull null];
9797
}
98-
NSMutableDictionary* message = [NSMutableDictionary dictionaryWithObject:data forKey:@"data"];
98+
NSMutableDictionary* message = [NSMutableDictionary dictionary];
99+
100+
if (data) {
101+
message[@"data"] = data;
102+
}
99103

100104
if (responseCallback) {
101105
NSString* callbackId = [NSString stringWithFormat:@"objc_cb_%ld", ++_uniqueId];

0 commit comments

Comments
 (0)