Resolved IndexOutOfBoundsException

Discussion in 'Client & Site Support' started by Ozzy, Dec 12, 2014.

  1. Ozzy

    Joined:
    Nov 5, 2014
    Messages:
    504
    Likes Received:
    159
    I've had these come through to my exception log:

    Code (Text):
    1. java.lang.IndexOutOfBoundsException: Index: 1, Size: 0
    2.  at java.util.ArrayList.rangeCheck(Unknown Source)
    3.  at java.util.ArrayList.get(Unknown Source)
    4.  at a.XK.new(jpb:232)
    5.  at a.XK.new(jpb:152)
    6.  at a.XK.move(jpb:50)
    7.  at com.runemate.game.api.hybrid.input.Mouse.move(yj:171)
    8.  at com.runemate.game.api.hybrid.input.Mouse.move(yj:4)
    9.  at com.runemate.game.api.hybrid.input.Mouse.click(yj:191)
    10.  at com.runemate.game.api.hybrid.location.Coordinate$MinimapCoordinate.click(ctb:2297)
    11.  at com.runemate.game.api.hybrid.location.Coordinate$MinimapCoordinate.interact(ctb:1420)
    12.  at com.runemate.game.api.hybrid.location.navigation.basic.BresenhamPath.step(sqb:92)
    13.  at com.runemate.game.api.hybrid.location.navigation.Path.step(trb:96)
    14.  at scripts.MassFighter.Tasks.CombatHandler.execute(CombatHandler.java:77)
    15.  at com.runemate.game.api.script.framework.task.TaskScript.onLoop(rkb:199)
    16.  at com.runemate.game.api.script.framework.LoopingScript.run(ajb:11)
    17.  at com.runemate.game.api.script.framework.AbstractScript.start(pkb:5)
    18.  at a.pK.run(slb:70)
    Code (Text):
    1. java.lang.IndexOutOfBoundsException: Index: 30, Size: 0
    2.  at java.util.ArrayList.rangeCheck(Unknown Source)
    3.  at java.util.ArrayList.get(Unknown Source)
    4.  at a.XK.new(jpb:232)
    5.  at a.XK.new(jpb:152)
    6.  at a.XK.move(jpb:50)
    7.  at com.runemate.game.api.hybrid.input.Mouse.move(yj:171)
    8.  at a.Cn.interact(mub:127)
    9.  at com.runemate.game.api.hybrid.entities.details.Interactable.interact(pi:175)
    10.  at scripts.MassFighter.Tasks.CombatHandler.execute(CombatHandler.java:71)
    11.  at com.runemate.game.api.script.framework.task.TaskScript.onLoop(rkb:199)
    12.  at com.runemate.game.api.script.framework.LoopingScript.run(ajb:11)
    13.  at com.runemate.game.api.script.framework.AbstractScript.start(pkb:5)
    14.  at a.pK.run(slb:70)
    The lines it refers to in my code:

    71:

    Code (Text):
    1. targetNpc.interact("Attack", targetNpc.getName())
    77:

    Code (Text):
    1. BresenhamPath.buildTo(targetNpc).step(true);
     
  2. Savior

    Savior I'm your motherfucking conscience

    Joined:
    Nov 17, 2014
    Messages:
    3,368
    Likes Received:
    1,351
    Seems like the targetNpc is the thing.
    java.lang.IndexOutOfBoundsException: Index: 1, Size: 0
    The size of the filtered npc list probably is 0, while the targetNpc still has an index?
    would you mind posting your filter or how you get the targetNpc?
     
  3. Ozzy

    Joined:
    Nov 5, 2014
    Messages:
    504
    Likes Received:
    159
    I check that the query results are not empty before assigning targetNpc a value. The only thing I've spotted that could be causing this is that I'm calling .limit(2).random() on query results that could possibly be < 2 in size, although I haven't been able to reproduce it.

    Would calling limit(2) on a query <2 in size cause this @Cloud?
     
  4. Cloud

    Joined:
    Jul 28, 2013
    Messages:
    2,518
    Likes Received:
    890
    It's clearly related to the mouse code on my end. Please wait for a fix.
     

Share This Page

Loading...