SlotAction.getName() giving npe

Discussion in 'Client & Site Support' started by Aidden, Sep 11, 2014.

  1. I keep getting an NPE from the following line, it seems to be coming from the getName() call
    Code (Text):
    1.  
    2. if (as != null && as.getName().equals("Superheat Item")) {
    @Cloud
     
  2. 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.
     
  3. Code (Text):
    1. java.lang.NullPointerException
    2.         at superheater.MaxiSuperheater.getSlot(MaxiSuperheater.java:168)
    3.         at superheater.MaxiSuperheater.superheatEoC(MaxiSuperheater.java:136)
    4.         at superheater.MaxiSuperheater.onLoop(MaxiSuperheater.java:100)
    5.         at com.runemate.game.api.script.framework.LoopingScript.run(rdb:84)
    6.         at com.runemate.game.api.script.framework.AbstractScript.start(lmb:80)
    7.         at com.runemate.b.aux.run(ygb:194)
    @Cloud
     
  4. 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?)
     
  5. 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:
    [​IMG]
    Code (Text):
    1.  
    2. (09:19:19) Iron ore
    3. (09:19:19) Backhand
    4. (09:19:19) Sever
    5. (09:19:19) Home Teleport
    6. (09:19:19) Varrock Teleport
    7. java.lang.NullPointerException
    8.         at com.runemate.e.aux.println(rjb:1)
    9.         at superheater.MaxiSuperheater.getSlot(MaxiSuperheater.java:168)
    10.         at superheater.MaxiSuperheater.superheatEoC(MaxiSuperheater.java:136)
    11.         at superheater.MaxiSuperheater.onLoop(MaxiSuperheater.java:100)
    12.         at com.runemate.game.api.script.framework.LoopingScript.run(rdb:84)
    13.         at com.runemate.game.api.script.framework.AbstractScript.start(lmb:80)
    14.         at com.runemate.b.aux.run(ygb:194)
    @Cloud
     
  6. Well it seems that it's not really a client issue and more of an issue where you need null checks :p
     
  7. 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.
     
  8. 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
     

Share This Page

Loading...