AFNetworking/AFOAuth1Client — pull request #85 by iwasrobbed (2013-09-18 15:45:00+00:00)
Title: Check for requestToken key and verifier before populating them

Hey Mattt,

I really appreciate all the work you've put into this and all things AFNetworking. My life is much easier because of it.

I just wanted to let you know that I found an error and here are the steps to reproduce it:

1. Open the Twitter iOS Example Client app and run it
2. When Safari is launched to the Twitter site to authenticate you, hit the "Cancel" button instead of hitting "Authorize"
3. The app should show an error like below since one of the NSDictionary params was trying to be populated with a nil item

>2013-09-18 11:36:51.304 Twitter iOS Example Client[2360:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot be nil (key: oauth_verifier)'
*** First throw call stack:
(0x2e9d0f53 0x390396af 0x2e90c727 0x8880f 0x87659 0x2f2ee817 0x2e993121 0x2e907317 0x672d1 0x313bc299 0x313487bf 0x31348697 0x311470cb 0x311469a9 0x311ac4fd 0x335d370d 0x335d32f7 0x2e99b9e7 0x2e99b983 0x2e99a157 0x2e904ce7 0x2e904acb 0x335d2283 0x311a6a41 0x66885 0x39541ab7)
libc++abi.dylib: terminating with uncaught exception of type NSException

I implemented a quick check and return an NSError object now if the response was malformed. Please let me know if you are able to merge this or if you think there is a better way to accomplish this.

Cheers,
Rob