jonnybrahh 2 Share Posted April 1 (edited) Hey all, I am currently getting a nullpointer thrown at me from this line if ((Widgets.getWidget(229).isVisible() && Widgets.getWidget(229) != null) || (Widgets.getWidget(219).isVisible() && Widgets.getWidget(219) != null)) i added the null check in after, but still gets nullpointer if anyone has any ideas, thanks in advance NEVERMIND, SOLVED! Had the nullcheckers in the wrong spot Edited April 1 by jonnybrahh Link to comment Share on other sites More sharing options...
fallacy87 8 Share Posted April 2 (edited) Do the null check first, it does it from left to right in your if statement. So, you are getting the null error when calling .isVisible() if you put the .isVisible after the null check it will never hit the .isVisible if it is null because it already knows the object is null and not to continue that statement (unless you give an OR clause in your statement later then you will have to check null again). Hope that makes sense. Edited April 2 by fallacy87 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now