crash when attempting to cache an invalid image #308

Closed
funkadelic opened this Issue Apr 19, 2012 · 1 comment

2 participants

@funkadelic

AFNetworking crashes when it attempts to cache an invalid image. eg:

http://b0.raptrcdn.com/img/avatars/small/f04b4c007cf01c77d9ec95b2ad477e97.127883f38b8bc0ce9d50d3ac9d0bc41d

the above request returns an HTTP 200 response, but it does not have a body in the HTTP response.

this results in a crash with the following in the console

2012-04-18 18:16:58.445 Raptr[41308:15203] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AFImageCache setObject:forKey:cost:]: attempt to insert nil value (key: http://b0.raptrcdn.com/img/avatars/small/f04b4c007cf01c77d9ec95b2ad477e97.127883f38b8bc0ce9d50d3ac9d0bc41d)'
*** First throw call stack:
(0x2160022 0x25f7cd6 0x20d818d 0x20d7fc3 0x132753 0x1321dc 0x127df9 0x1f23330 0x1f25509 0x2097803 0x2096d84 0x2096c9b 0x28097d8 0x280988a 0xcf4626 0x2e1d 0x2d95)
terminate called throwing an exception(lldb) 
@mattt

Thanks for pointing this out. I just pushed a fix for this in 9adb586. Cheers!

@mattt mattt closed this Apr 19, 2012
@egrim egrim pushed a commit to egrim/AFNetworking that referenced this issue Sep 18, 2012
@mattt mattt [Issue #308] Fixing crash caused by attempting to cache invalid or ni…
…l image
4a37b2a
@greghe greghe pushed a commit to skillz/AFNetworking that referenced this issue Sep 3, 2015
@mattt mattt [Issue #308] Fixing crash caused by attempting to cache invalid or ni…
…l image
6b90234
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment