On Feb 8, 2016, at 10:01 AM, Ken Thomases <k...@codeweavers.com> wrote:
>>> 
>>> In the case where you do not see a warning, you are calling -[NSDictionary 
>>> objectForKey:] which accepts a nil key value (returning nil).
>> 
>> Ahhhhh, for some reason I thought that is was illegal to pass a nil key to 
>> objectForkey:
> 
> It is illegal.  Michael is incorrect.  In general, when a method accepts an 
> object pointer argument, it is illegal to pass nil unless it's specifically 
> documented to be legal.

The nil key pointer is a red herring. -[NSDictionary objectForKey:] can return 
nil if the dictionary doesn’t contain a value for the key.

The analyser is correctly flagging that the code doesn’t handle this case.

I suspect the reason that this started recently is that Apple recently started 
annotation the Cocoa headers as to what can and can’t accept/return nil in 
support of Swift.

HTH,

-Steve
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to