mardi 1 septembre 2015

Why is my if statement being entered when passed a null block?

I'm trying to make a failsafe to guarantee a null block is never attempted to be executed. To do this, I use a custom property getter, which returns the block if it's not null, else it returns an empty block. However! The if statement is always entered! Then, I get an EXC_BAD_ACCESS when it tries to return the block!

It looks like the block isn't defined, as it has a value of 0x0000000000000000, and its __FuncPtr is NULL, so why is this if statement being entered?

A screenshot of Xcode, showing an object called _pinPadCompletionBlock with a value of 0x0000000000000000, as the only conditional in an if statement, and the program counter on the next line. Below this is the inspector wherein __FuncPtr is NULL.

My block is declared as:

@property (nonatomic, assign) void (^pinPadCompletionBlock)(bool);

Aucun commentaire:

Enregistrer un commentaire