From 86d4f4e20a89f4ff2c8fd3cc7972ec2518ba00c2 Mon Sep 17 00:00:00 2001 From: Stanislav Vishnevskiy Date: Thu, 11 Jun 2015 18:02:52 -0700 Subject: [PATCH] [WebSocket] Reason can be null which causes an exception with NSDictionary in websocketClosed Summary: I am not 100% sure what causes reason to be null but it does happen. Closes https://github.com/facebook/react-native/pull/1483 Github Author: Stanislav Vishnevskiy Test Plan: Imported from GitHub, without a `Test Plan:` line. --- Libraries/WebSocket/RCTWebSocketManager.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/WebSocket/RCTWebSocketManager.m b/Libraries/WebSocket/RCTWebSocketManager.m index a403e0a0a..2622afcd6 100644 --- a/Libraries/WebSocket/RCTWebSocketManager.m +++ b/Libraries/WebSocket/RCTWebSocketManager.m @@ -107,7 +107,7 @@ RCT_EXPORT_METHOD(close:(NSNumber *)socketID) { [_bridge.eventDispatcher sendDeviceEventWithName:@"websocketClosed" body:@{ @"code": @(code), - @"reason": reason, + @"reason": reason ? reason : [NSNull null], @"clean": @(wasClean), @"id": webSocket.reactTag }];