From 58c7249fb89698d7b648a369ea4e8147583ace39 Mon Sep 17 00:00:00 2001 From: finscn Date: Wed, 14 Sep 2016 18:54:53 +0800 Subject: [PATCH] reason maybe nil in SocketRocket When reason== nil, will take an error about EXC_BAD_ACCESS --- Source/Ejecta/EJUtils/EJBindingWebSocket.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Ejecta/EJUtils/EJBindingWebSocket.m b/Source/Ejecta/EJUtils/EJBindingWebSocket.m index 393efecf..b9fb5aa4 100644 --- a/Source/Ejecta/EJUtils/EJBindingWebSocket.m +++ b/Source/Ejecta/EJUtils/EJBindingWebSocket.m @@ -100,7 +100,7 @@ - (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reas JSContextRef ctx = scriptView.jsGlobalContext; [self triggerEvent:@"close" properties:(JSEventProperty[]){ {"code", JSValueMakeNumber(ctx, code)}, - {"reason", NSStringToJSValue(ctx, reason)}, + {"reason", reason ? NSStringToJSValue(ctx, reason) : scriptView->jsUndefined }, {"wasClean", JSValueMakeBoolean(ctx, wasClean)}, {NULL, NULL}, }];