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
  • Bank.openClosest() throws NPE


    Dorkinator

    Recommended Posts

    [ERROR] Trying to access a null object!
    java.lang.NullPointerException
    at org.dreambot.api.wrappers.map.TileReference.getGridY(TileReference.java:104)
    at org.dreambot.api.methods.walking.path.impl.LocalPath.walkTileMM(LocalPath.java:93)
    at org.dreambot.api.methods.walking.path.impl.LocalPath.walk(LocalPath.java:77)
    at org.dreambot.api.methods.walking.path.impl.GlobalPath.walk(GlobalPath.java:38)
    at org.dreambot.api.methods.walking.impl.Walking.walk(Walking.java:123)
    at org.dreambot.api.methods.container.impl.bank.Bank.open(Bank.java:255)
    at org.dreambot.api.methods.container.impl.bank.Bank.openClosest(Bank.java:265)
    at walking.Walking.openBank(Walking.java:118)
    at jobs.BankNode.execute(BankNode.java:55)
    at main.Woodcutter.onLoop(Woodcutter.java:73)
    at org.dreambot.api.script.AbstractScript.run(AbstractScript.java:250)
    at java.lang.Thread.run(Unknown Source)
    Here's the stack trace. This happened at Draynor bank.
    Link to comment
    Share on other sites

    You can always just do:

    GameObject bankBooth = getGameObjects().closest(f -> f != null && f.getName().equalsIgnoreCase("Bank booth") && f.hasAction("Bank"));
    
    // then
    
    bankBooth.interact("Bank");
    
    Link to comment
    Share on other sites

     

    You can always just do:

    GameObject bankBooth = getGameObjects().closest(f -> f != null && f.getName().equalsIgnoreCase("Bank booth") && f.hasAction("Bank));
    
    // then
    
    bankBooth.interact("Bank");
    

    Hey u missed a " noob

    Link to comment
    Share on other sites

    You can always just do:

    GameObject bankBooth = getGameObjects().closest(f -> f != null && f.getName().equalsIgnoreCase("Bank booth") && f.hasAction("Bank));
    
    // then
    
    bankBooth.interact("Bank");
    

     

    I'm not looking for a patch, I'm reporting a bug in the API.
    Link to comment
    Share on other sites

    I'm not looking for a patch, I'm reporting a bug in the API.

     

    I also find it annoying when other scripters try and give you workarounds when you are just trying to report a fucking bug.

    Link to comment
    Share on other sites

    Im not sure from where you called the method but the first line of the stacktrace:

    at org.dreambot.api.wrappers.map.TileReference.getGridY(TileReference.java:104)
    
    is thrown when a map chunk, or whatever it is called is loaded/unloaded and you try to walk in that specific moment or check for Tiles, I also know that openClosest attempts to walk to the nearest Bank if it cant find any.

    I have been told that any getGridY can be ignored.

    I might be wrong but I've been told numerous times to ignore any getGrid errors.

     

    If it can be ignored it should be ignored in the API, not left in the API to throw random NPEs.
    Link to comment
    Share on other sites

    Im not sure from where you called the method but the first line of the stacktrace:

    at org.dreambot.api.wrappers.map.TileReference.getGridY(TileReference.java:104)
    

    is thrown when a map chunk, or whatever it is called is loaded/unloaded and you try to walk in that specific moment or check for Tiles, I also know that openClosest attempts to walk to the nearest Bank if it cant find any.

    I have been told that any getGridY can be ignored.

    I might be wrong but I've been told numerous times to ignore any getGrid errors.

    Pretty much this.

    Link to comment
    Share on other sites

    Like it has been said in the thread, the gridX/Y errors are issues with operating on tiles that have just been unloaded.

    The line of the error, for reference, is return yRef != null yRef.get() : -1;

     

    It shouldn't stop your script from operating.

    It does stop the current call from finishing, which as you can see in the stack trace is a walkTileMM method in walk.

    So while you think we should just push the error under the rug so you don't have to see it, it's still a reminder that a method did fail to finish, and for anybody who is watching the script run very, very closely it's an explanation as to why it did not click the minimap when they believed it should have.

    I can probably add a try/catch on it and print a different message before the stack trace, though.

    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.