title: Why do nil / NULL blocks cause bus errors when run?
body: <p>I started using blocks a lot and soon noticed that nil blocks cause bus errors:</p>
  
  <pre><code>typedef void (^SimpleBlock)(void);
  SimpleBlock aBlock = nil;
  aBlock(); // bus error
  </code></pre>
  
  <p>This seems to go against the usual behaviour of Objective-C that ignores messages to nil objects:</p>
  
  <pre><code>NSArray *foo = nil;
  NSLog(@"%i", [foo count]); // runs fine
  </code></pre>
  
  <p>Therefore I have to resort to the usual nil check before I use a block:</p>
  
  <pre><code>if (aBlock != nil)
      aBlock();
  </code></pre>
  
  <p>Or use dummy blocks:</p>
  
  <pre><code>aBlock = ^{};
  aBlock(); // runs fine
  </code></pre>
  
  <p>Is there another option? Is there a reason why nil blocks couldn’t be simply a nop?</p>