MobileChromeApps/mobile-chrome-apps — pull request #158 by MiCHiLU (2014-05-10 11:48:42+00:00)
Title: Ignore if MIMEType method return nil.

I got NSInvalidArgumentException in my app case.
MIMEType instance method of the NSURLResponse returns nil sometimes.

https://developer.apple.com/library/mac/documentation/cocoa/reference/foundation/classes/nsurlresponse_class/Reference/Reference.html#//apple_ref/occ/instm/NSURLResponse/MIMEType

MyApp[9066] : *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[1]'
*** First throw call stack:
(
0 CoreFoundation 0x0020f1e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x025688e5 objc_exception_throw + 44
2 CoreFoundation 0x001d5376 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 390
3 CoreFoundation 0x00202c29 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 73
4 MyApp 0x00053b5d -[ChromeURLProtocol connection:didReceiveResponse:] + 221
5 Foundation 0x01c90f54 ___NSURLConnectionDidReceiveResponse_block_invoke + 79
6 Foundation 0x01c277e1 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 62
7 Foundation 0x01aaff5e -[NSURLConnectionInternalConnection invokeForDelegate:] + 119
8 Foundation 0x01aafec6 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 208
9 Foundation 0x01aafdd8 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 76
10 Foundation 0x01aaffc9 _NSURLConnectionDidReceiveResponse + 87
11 CFNetwork 0x06306eb0 ___ZN27URLConnectionClient_Classic28_delegate_didReceiveResponseEP14_CFURLResponse_block_invoke + 125
12 CFNetwork 0x063023de ___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 104
13 CoreFoundation 0x001b0c69 CFArrayApplyFunction + 57
14 CFNetwork 0x0626b441 _ZN19RunloopBlockContext7performEv + 155
15 CFNetwork 0x0634d3f4 _ZThn16_N19RunloopBlockContext24multiplexerClientPerformEv + 20
16 CFNetwork 0x0626b257 _ZN17MultiplexerSource7performEv + 299
17 CFNetwork 0x0626b06c _ZN17MultiplexerSource8_performEPv + 76
18 CoreFoundation 0x0019877f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
19 CoreFoundation 0x0019810b __CFRunLoopDoSources0 + 235
20 CoreFoundation 0x001b51ae __CFRunLoopRun + 910
21 CoreFoundation 0x001b49d3 CFRunLoopRunSpecific + 467
22 CoreFoundation 0x001b47eb CFRunLoopRunInMode + 123
23 WebCore 0x04d49a18 _ZN7WebCoreL15runLoaderThreadEPv + 360
24 JavaScriptCore 0x09093b2c _ZN3WTFL16threadEntryPointEPv + 76
25 JavaScriptCore 0x09094025 _ZN3WTFL19wtfThreadEntryPointEPv + 21
26 libsystem_c.dylib 0x02df45b7 _pthread_start + 344
27 libsystem_c.dylib 0x02ddedce thread_start + 34
)
backboardd[55407] : Application 'UIKitApplication:com.example.myapp[0x854f]' exited abnormally with signal 6: Abort trap: 6