azure-notificationhubs-ios icon indicating copy to clipboard operation
azure-notificationhubs-ios copied to clipboard

-[SBNotificationHub parseResultAndUpdateWithName:data:error:]

Open bhavesh-di opened this issue 2 years ago • 3 comments

Bug Title -[SBNotificationHub parseResultAndUpdateWithName:data:error:] NSRangeException - *** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array

Exception or Stack Trace Fatal Exception: NSRangeException 0 CoreFoundation 0x9e38 __exceptionPreprocess 1 libobjc.A.dylib 0x178d8 objc_exception_throw 2 CoreFoundation 0x1af078 -[__NSCFString characterAtIndex:].cold.1 3 CoreFoundation 0x1a42c -[__NSArrayM objectAtIndex:] 4 RNDC 0xea63d8 -[SBNotificationHub parseResultAndUpdateWithName:data:error:] + 287 (SBNotificationHub.m:287) 5 RNDC 0xea62b8 __82-[SBNotificationHub upsertRegistrationWithName:registrationId:payload:completion:]_block_invoke + 274 (SBNotificationHub.m:274) 6 RNDC 0xea06ac -[SBURLConnection connectionDidFinishLoading:] + 116 (SBURLConnection.m:116) 7 FirebasePerformance 0x157d0 (Missing UUID 7934ed34949930e8894c0952de7a1bf4) 8 CFNetwork 0x272f54 __CFTubeSetTubeTypeNotifier 9 CFNetwork 0x272ef4 __CFTubeSetTubeTypeNotifier 10 CFNetwork 0x273014 __CFTubeSetTubeTypeNotifier 11 CFNetwork 0x1bdff8 _CFNetworkErrorGetLocalizedDescription 12 CFNetwork 0x1bc800 _CFNetworkErrorGetLocalizedDescription 13 libdispatch.dylib 0x3f88 _dispatch_client_callout 14 libdispatch.dylib 0x7a08 _dispatch_block_invoke_direct 15 CFNetwork 0x256fb8 _CFURLStorageSessionDisableCache 16 CoreFoundation 0x16c20 CFArrayApplyFunction 17 CFNetwork 0x256e90 _CFURLStorageSessionDisableCache 18 CFNetwork 0x259408 _CFURLStorageSessionDisableCache 19 CoreFoundation 0xd5f24 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION 20 CoreFoundation 0xe22fc __CFRunLoopDoSource0 21 CoreFoundation 0x661c0 __CFRunLoopDoSources0 22 CoreFoundation 0x7bb7c __CFRunLoopRun 23 CoreFoundation 0x80eb0 CFRunLoopRunSpecific 24 GraphicsServices 0x1368 GSEventRunModal 25 UIKitCore 0x3a1668 -[UIApplication _run] 26 UIKitCore 0x3a12cc UIApplicationMain 27 RNDC 0xbfb40 main + 29 (AppDelegate.swift:29) 28 ??? 0x1ec700960 (Missing) To Reproduce

  • (void)parseResultAndUpdateWithName:(NSString *)name data:(NSData *)data error:(NSError *__autoreleasing *)error { NSError *parseError; NSArray *registrations = [SBRegistrationParser parseRegistrations:data error:&parseError]; if (!parseError) { //When we getting nil array that time we found crashed *[storageManager updateWithRegistrationName:name registration:(SBRegistration )[registrations objectAtIndex:0]]; } else if (error) { (*error) = parseError; } }

Code Snippet

  • (void)parseResultAndUpdateWithName:(NSString *)name data:(NSData *)data error:(NSError *__autoreleasing *)error { NSError *parseError; NSArray *registrations = [SBRegistrationParser parseRegistrations:data error:&parseError]; if (!parseError) { //When we getting nil array that time we found crashed *[storageManager updateWithRegistrationName:name registration:(SBRegistration )[registrations objectAtIndex:0]]; } else if (error) { (*error) = parseError; } }

Expected behavior Handle nil array

Screenshots image

bhavesh-di avatar Jul 28 '23 12:07 bhavesh-di

Any update?

vishaldeshai avatar Oct 17 '24 11:10 vishaldeshai

Any update on this bug? Occurrance is rare, but this is still occurring randomly!

rrastogi-ex2 avatar Dec 02 '24 09:12 rrastogi-ex2

Any updates on this issue? We're still experiencing the same problem.

harshit090891 avatar Jul 14 '25 13:07 harshit090891