Fixes a few small setObject:forKey: exceptions that can be triggered

I saw at least one of these occurring in the Tumblr app, so I decided to just audit the code for instances of `setObject:ForKey:` where either the key or object could be nil and make sure the appropriate checks were in place.