Skip to content

Instantly share code, notes, and snippets.

@mattjgalloway
Last active August 29, 2015 14:13
Show Gist options
  • Save mattjgalloway/54577d4039a81a4b4168 to your computer and use it in GitHub Desktop.
Save mattjgalloway/54577d4039a81a4b4168 to your computer and use it in GitHub Desktop.
Running a block^WNSNull. Wait what?
// On iOS...
// This doesn't crash:
id null = @[[NSNull null]];
dispatch_block_t block = (dispatch_block_t)null[0];
block();
// This does:
id null = [NSNull null];
dispatch_block_t block = (dispatch_block_t)null;
block();
// Points to the person who points out *why* the first doesn't crash. And more points for why the second one does.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment