Skip to content

Commit 3f5d5cf

Browse files
committed
extend to end event
1 parent b09b644 commit 3f5d5cf

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ios/src/CountlyReactNative.m

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,10 +469,13 @@ + (void)log:(NSString *)theMessage {
469469
NSNumber *sumNumber = [arguments objectForKey:@"s"];
470470
float sumFloat = [sumNumber floatValue];
471471

472-
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
472+
NSMutableDictionary *dict = nil;
473473
NSArray *segments = [arguments objectForKey:@"g"];
474-
for (int i = 0, il = (int)segments.count; i < il; i += 2) {
475-
dict[[segments objectAtIndex:i]] = [segments objectAtIndex:i + 1];
474+
if (segments != nil) {
475+
dict = [[NSMutableDictionary alloc] init];
476+
for (int i = 0, il = (int)segments.count; i < il; i += 2) {
477+
dict[[segments objectAtIndex:i]] = [segments objectAtIndex:i + 1];
478+
}
476479
}
477480
[[Countly sharedInstance] endEvent:eventName segmentation:dict count:countInt sum:sumFloat];
478481
});

0 commit comments

Comments
 (0)