nxtbgthng / OAuth2Client

Client library for OAuth2 (currently built against draft 10 of the OAuth2 spec)
855 stars 217 forks source link

Code attempting to remove nil accountType from array causing a crash #182

Closed bmctigue closed 8 years ago

bmctigue commented 9 years ago

Hi All, We've had 2 crashes reported by Crashlytics for code attempting to remove a nil accountType from pendingOAuthClients. The offending code happens in 2 places. I created a pull request which fixes this. The cure already exists in another method so I just used the code to check for nil in the 2 problem methods. I submitted a pull request which should take care of this. Bruce

bmctigue commented 9 years ago

Stack trace for the exception: Thread : Fatal Exception: NSInvalidArgumentException 0 CoreFoundation 0x2905dfef exceptionPreprocess + 126 1 libobjc.A.dylib 0x375abc8b objc_exception_throw + 38 2 CoreFoundation 0x28f90e5b -[NSDictionaryM removeObjectForKey:] + 618 3 betterup 0x00161d91 -NXOAuth2AccountStore oauthClient:didFailToGetAccessTokenWithError: 4 betterup 0x00165257 -NXOAuth2Client oauthConnection:didFailWithError: 5 betterup 0x001672a7 -NXOAuth2Connection connection:didFailWithError: 6 CFNetwork 0x28b9fe29 65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 56 7 CFNetwork 0x28b9fde3 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 182 8 CFNetwork 0x28b9ff05 -[NSURLConnectionInternal _withConnectionAndDelegate:] + 36 9 CFNetwork 0x28b8d829 _NSURLConnectionDidFail(CFURLConnection, CFError, void const) + 84 10 CFNetwork 0x28b5279b ___ZN27URLConnectionClient_Classic17_delegate_didFailEP9CFErrorU13block_pointerFvvE_block_invoke + 86 11 CFNetwork 0x28b510d5 _ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 60 12 CFNetwork 0x28aa4a35 RunloopBlockContext::_invokeblock(void const, void_) + 60 13 CoreFoundation 0x28f6dc6d CFArrayApplyFunction + 36 14 CFNetwork 0x28aa48ef RunloopBlockContext::perform() + 182 15 CFNetwork 0x28aa47b5 MultiplexerSource::perform() + 216 16 CFNetwork 0x28aa4649 MultiplexerSource::perform(void) + 48 17 CoreFoundation 0x29023faf CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 14 18 CoreFoundation 0x290233bf CFRunLoopDoSources0 + 218 19 CoreFoundation 0x29021a25 CFRunLoopRun + 772 20 CoreFoundation 0x28f6e201 CFRunLoopRunSpecific + 476 21 CoreFoundation 0x28f6e013 CFRunLoopRunInMode + 106 22 GraphicsServices 0x3084d201 GSEventRunModal + 136 23 UIKit 0x2c712a59 UIApplicationMain + 1440 24 betterup 0x000cdb2b main (main.m:14) 25 libdyld.dylib 0x37b37aaf start + 2