HintArrows.getLoaded().get(0) gives me an NPE

Discussion in 'Developer Support' started by Furor, Feb 11, 2015.

  1. Here is the code I'm trying to use to get the falcon specific to the local player, however it always gives me an NPE. I get a java.lang.arrayindexoutofboundsexception error when it tries to run.
    Code (Text):
    1. if (HintArrows.getLoaded() != null) {
    3.                     HintArrow caught = HintArrows.getLoaded().get(0);
    5.                     if (caught != null) {
    6.                         Npc caughtBird = Npcs.getLoadedAt(caught.getPosition()).first();
    7.                         clickThing(caughtBird, "Retrieve");
    9.                 }
    10.      }
    The HintArrow definitely is not null and from what I understand, 0 should be the very first loaded HintArrow, so what is causing the error?

    Edit: Mostly fixed, I'm just having problems with interacting with the falcon...
    #1 Furor, Feb 11, 2015
    Last edited: Feb 11, 2015
  2. If it's an ArrayIndexOutOfBoundsException then the query results are empty.
  3. Aidden pointed this out on skype and I just made sure to check that the list wasn't empty and I was able to mostly solve my problem. I had trouble with clicking the falcon though, the results weren't empty but the script bot would be stuck trying to interact but wouldn't. For now I've just made falcon retrieval only activate when the HintArrow doesn't return an empty list and then just relied on clicking the closest falcon, which should prevent clicking other people's falcons in a majority of cases.
  4. What's the NPE you said you were getting btw?

Share This Page