Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Widget throwing nullpointer


    Recommended Posts

    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



    Had the nullcheckers in the wrong spot

    Edited by jonnybrahh
    Link to comment
    Share on other sites

    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 by fallacy87
    Link to comment
    Share on other sites

    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 account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.