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):
    2. if (as != null && as.getName().equals("Superheat Item")) {
  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(
    3.         at superheater.MaxiSuperheater.superheatEoC(
    4.         at superheater.MaxiSuperheater.onLoop(
    5.         at
    6.         at
    7.         at
  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:
    Code (Text):
    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(
    10.         at superheater.MaxiSuperheater.superheatEoC(
    11.         at superheater.MaxiSuperheater.onLoop(
    12.         at
    13.         at
    14.         at
  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