From 04ee2345788fecad1a832808e6cbeecc113345ff Mon Sep 17 00:00:00 2001 From: Scott Kyle Date: Tue, 12 Jan 2016 17:07:48 -0800 Subject: [PATCH] Improve clarity of addListenerForEvent:hander: --- react-native/RealmReact.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/react-native/RealmReact.mm b/react-native/RealmReact.mm index d1bd84c6..6715a88c 100644 --- a/react-native/RealmReact.mm +++ b/react-native/RealmReact.mm @@ -96,7 +96,10 @@ extern "C" JSGlobalContextRef RealmReactGetJSGlobalContextForExecutor(id executo } - (void)addListenerForEvent:(NSString *)eventName handler:(RealmReactEventHandler)handler { - NSMutableOrderedSet *handlers = _eventHandlers[eventName] ?: (_eventHandlers[eventName] = [[NSMutableOrderedSet alloc] init]); + NSMutableOrderedSet *handlers = _eventHandlers[eventName]; + if (!handlers) { + handlers = _eventHandlers[eventName] = [[NSMutableOrderedSet alloc] init]; + } [handlers addObject:handler]; }