Welcome!

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

Sign up now!

SlotAction.getName() giving npe

Author of MaxiBots
Joined
Dec 3, 2013
Messages
7,032
I keep getting an NPE from the following line, it seems to be coming from the getName() call
Code:
if (as != null && as.getName().equals("Superheat Item")) {
@Cloud
 
Engineer
Joined
Jul 28, 2013
Messages
2,776
I keep getting an NPE from the following line, it seems to be coming from the getName() call
Code:
if (as != null && as.getName().equals("Superheat Item")) {
@Cloud
SlotAction#getName may be returning null, however the call itself doesn't appear to be creating the null pointer. Please provide a full stack trace.
 
Author of MaxiBots
Joined
Dec 3, 2013
Messages
7,032
SlotAction#getName may be returning null, however the call itself doesn't appear to be creating the null pointer. Please provide a full stack trace.
Code:
java.lang.NullPointerException
        at superheater.MaxiSuperheater.getSlot(MaxiSuperheater.java:168)
        at superheater.MaxiSuperheater.superheatEoC(MaxiSuperheater.java:136)
        at superheater.MaxiSuperheater.onLoop(MaxiSuperheater.java:100)
        at com.runemate.game.api.script.framework.LoopingScript.run(rdb:84)
        at com.runemate.game.api.script.framework.AbstractScript.start(lmb:80)
        at com.runemate.b.aux.run(ygb:194)

@Cloud
 
Engineer
Joined
Jul 28, 2013
Messages
2,776
Code:
java.lang.NullPointerException
        at superheater.MaxiSuperheater.getSlot(MaxiSuperheater.java:168)
        at superheater.MaxiSuperheater.superheatEoC(MaxiSuperheater.java:136)
        at superheater.MaxiSuperheater.onLoop(MaxiSuperheater.java:100)
        at com.runemate.game.api.script.framework.LoopingScript.run(rdb:84)
        at com.runemate.game.api.script.framework.AbstractScript.start(lmb:80)
        at com.runemate.b.aux.run(ygb:194)

@Cloud
Yeah that just means the method is returning null (I'll check into why later, but out of curiosity what item's name is returning null?)
 
Author of MaxiBots
Joined
Dec 3, 2013
Messages
7,032
Yeah that just means the method is returning null (I'll check into why later, but out of curiosity what item's name is returning null?)
Interesting. It seems to be on an empty slot, but not the first empty slot.
Here is an image of my actionbar and the getName() results:
Screenshot%202014-09-12%2009.19.48.png

Code:
(09:19:19) Iron ore
(09:19:19) Backhand
(09:19:19) Sever
(09:19:19) Home Teleport
(09:19:19) Varrock Teleport
java.lang.NullPointerException
        at com.runemate.e.aux.println(rjb:1)
        at superheater.MaxiSuperheater.getSlot(MaxiSuperheater.java:168)
        at superheater.MaxiSuperheater.superheatEoC(MaxiSuperheater.java:136)
        at superheater.MaxiSuperheater.onLoop(MaxiSuperheater.java:100)
        at com.runemate.game.api.script.framework.LoopingScript.run(rdb:84)
        at com.runemate.game.api.script.framework.AbstractScript.start(lmb:80)
        at com.runemate.b.aux.run(ygb:194)
@Cloud
 
Engineer
Joined
Jul 28, 2013
Messages
2,776
Well it seems that it's not really a client issue and more of an issue where you need null checks :p
 
Author of MaxiBots
Joined
Dec 3, 2013
Messages
7,032
Well it seems that it's not really a client issue and more of an issue where you need null checks :p
But all those slots in the middle that were empty didn't throw an error, and then once it got to the end of the ab it throws an error. I'll do one more test, printing out which slot it is to determine exactly which one it is.
 
Author of MaxiBots
Joined
Dec 3, 2013
Messages
7,032
Okay found the issue, the SlotAction doesn't return null when they're empty but of course when they're empty the name is null, so i needed a double null check. All good now
 
Top