Skip to content

Instantly share code, notes, and snippets.

@krzysztofzablocki
Created December 19, 2012 12:36
Show Gist options
  • Save krzysztofzablocki/4336389 to your computer and use it in GitHub Desktop.
Save krzysztofzablocki/4336389 to your computer and use it in GitHub Desktop.
Simplified check as nil is fine
#define SafeCall(arg, methodToCall) (arg !=[NSNull null]) ? [arg methodToCall] : nil
int optionalValue = SafeCall([response valueForKey:@"number"], intValue);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment