Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-redundant nil check #229

Open
ryuichis opened this issue Dec 2, 2014 · 1 comment
Open

Non-redundant nil check #229

ryuichis opened this issue Dec 2, 2014 · 1 comment

Comments

@ryuichis
Copy link
Contributor

ryuichis commented Dec 2, 2014

Consider this code:
1. foo  = [some thing];
2. if(foo && [foo check:[bar methodWithSideEffect]]){ };
3. if([foo check:[bar methodWithSideEffect]]){ };

OCLint complains that line 2 has a redundant nil-check and does not complain about line 3. However, due to short-circuit operation,  line 2 fails to invoke '[bar methodWithSideEffect]'  while line 3 does invoke it, even if foo is nil.

These checks are not redundant if any parameter of the method call contains a call to any other method.

The discussion of this issue can be found at https://groups.google.com/forum/#!topic/oclint-users/FDmmdAXl_AE

@ryuichi-assistant
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by adding a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants