BAD_POINTER_COMPARISON Implicitly checking whether NSNumber pointer value is nil at line.
(BOOL)setValue:(NSNumber *)value forUnit:(NSString *)unit { if(value) { //some code here } }
I am getting the above error in my code. What is the expectation here, Can some one give an example. I am getting lot errors like this. Please suggest.
A common mistake is to write if(value) when intending to test whether value is a non-zero integer, while the code actually tests whether value is nil. If you instead write if(value != nil) explicitly, then the warning should not be reported.
Thank you @jberdine
Some documentation: http://fbinfer.com/docs/infer-bug-types.html#BAD_POINTER_COMPARISON