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
  • how to fix null pointer issue


    scape2code

    Recommended Posts

        I want to it to sleep until the widget is visibile but I get a null pointer exception until that actually happens but its only going to be null or only supposed to be null until I interact with the 2 objects what do I do to fix this or does it not matter. It seems like my program may skip a sleep statement which throws everything off.  Code below is basically just me debugging problem

    	if(getWidgets().getWidgetChild(270,14,38) == null)
    		{
    			log("widget child isnot visible yet");
    			sleepUntil(()->getWidgets().getWidgetChild(270,14,38).isVisible(),10000);
    			log("widget child is  visible son");
    		}

     

    Link to comment
    Share on other sites

    You enter that if statement when the widget is equal to null, so you are getting a null pointer exception when you do 

    sleepUntil(()->getWidgets().getWidgetChild(270,14,38).isVisible(),10000);

    because you are trying to do that on a null widget. Instead maybe you could try something like

    sleepUntil(()->getWidgets().getWidgetChild(270,14,38) != null,10000);

     

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • 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.