Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Bug Ground Item nullpointer

Joined
Dec 23, 2020
Messages
1
using the following code and getting the following error, this is on a rooftop course btw:

Code:
GroundItem mark = GroundItems.newQuery().names("Mark of grace").results().nearest();


Code:
java.lang.NullPointerException
    at nul.iIIiIIiiIiIiI.IiiIIiiiiIiIi(zmc:179)
    at com.runemate.game.api.hybrid.region.Region.getCurrentPlane(hha:15)
    at nul.IiiiiIiiIiiiI.IiiIIiiiiIiIi(ohc:145)
    at com.runemate.game.api.hybrid.region.GroundItems.getLoaded(wvc:132)
    at com.runemate.game.api.hybrid.region.GroundItems.getLoaded(wvc:145)
    at com.runemate.game.api.hybrid.queries.GroundItemQueryBuilder.IiiIIiiiiIiIi(iyc:21)
    at com.runemate.game.api.hybrid.queries.QueryBuilder.IiiIIiiiiIiIi(pjc:221)
    at com.runemate.game.api.hybrid.queries.QueryBuilder.results(pjc:162)
    at com.ancillary.bots.anagility.nodes.NavigateObstacleNode.takeGraceMark(NavigateObstacleNode.java:89)
    at com.ancillary.bots.anagility.nodes.NavigateObstacleNode.execute(NavigateObstacleNode.java:42)
    at com.ancillary.bots.anagility.AnAgility.onLoop(AnAgility.java:34)
    at com.runemate.game.api.script.framework.LoopingBot.run(lgc:165)
    at com.runemate.game.api.script.framework.AbstractBot.start(nhc:505)
    at nul.IiiIiIiiiiiiI.run(vvc:159)

literally the next line i am checking if mark != null, but the NPE is on the line where i am running the query.
 
cuppa.drink(java);
Joined
Mar 13, 2018
Messages
7,745
Code:
GroundItems.newQuery().names("Mark of grace").results()

Can rarely return null. You need to nullcheck the query results before calling nearest() to avoid this.
 
Top