Showing posts with label "Potential null dereference". Show all posts
Showing posts with label "Potential null dereference". Show all posts

Wednesday, February 22, 2012

Fixing “Potential null dereference. According to coding standards in ‘Creating and Returning NSError Objects’ the parameter ‘error’ may be null” after running Analyzer

Real quick post- if you run static analyzer, Clang, etc and it’s giving you this issue, it’s an easy fix. The error references the documentation that you can look at: “Creating and Returning NSError Objects” -see section 3-5.

This is what the error will look like:

This is how you fix it:


Pretty simple just put an if statement around it to make sure error isn’t null already!

Just saw this:
http://stackoverflow.com/questions/1189518/clang-error-on-potential-null-dereference

Followers