Welcome!

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

Sign up now!

Resolved IndexOutOfBoundsException

Joined
Nov 5, 2014
Messages
505
I've had these come through to my exception log:

Code:
java.lang.IndexOutOfBoundsException: Index: 1, Size: 0
 at java.util.ArrayList.rangeCheck(Unknown Source)
 at java.util.ArrayList.get(Unknown Source)
 at a.XK.new(jpb:232)
 at a.XK.new(jpb:152)
 at a.XK.move(jpb:50)
 at com.runemate.game.api.hybrid.input.Mouse.move(yj:171)
 at com.runemate.game.api.hybrid.input.Mouse.move(yj:4)
 at com.runemate.game.api.hybrid.input.Mouse.click(yj:191)
 at com.runemate.game.api.hybrid.location.Coordinate$MinimapCoordinate.click(ctb:2297)
 at com.runemate.game.api.hybrid.location.Coordinate$MinimapCoordinate.interact(ctb:1420)
 at com.runemate.game.api.hybrid.location.navigation.basic.BresenhamPath.step(sqb:92)
 at com.runemate.game.api.hybrid.location.navigation.Path.step(trb:96)
 at scripts.MassFighter.Tasks.CombatHandler.execute(CombatHandler.java:77)
 at com.runemate.game.api.script.framework.task.TaskScript.onLoop(rkb:199)
 at com.runemate.game.api.script.framework.LoopingScript.run(ajb:11)
 at com.runemate.game.api.script.framework.AbstractScript.start(pkb:5)
 at a.pK.run(slb:70)

Code:
java.lang.IndexOutOfBoundsException: Index: 30, Size: 0
 at java.util.ArrayList.rangeCheck(Unknown Source)
 at java.util.ArrayList.get(Unknown Source)
 at a.XK.new(jpb:232)
 at a.XK.new(jpb:152)
 at a.XK.move(jpb:50)
 at com.runemate.game.api.hybrid.input.Mouse.move(yj:171)
 at a.Cn.interact(mub:127)
 at com.runemate.game.api.hybrid.entities.details.Interactable.interact(pi:175)
 at scripts.MassFighter.Tasks.CombatHandler.execute(CombatHandler.java:71)
 at com.runemate.game.api.script.framework.task.TaskScript.onLoop(rkb:199)
 at com.runemate.game.api.script.framework.LoopingScript.run(ajb:11)
 at com.runemate.game.api.script.framework.AbstractScript.start(pkb:5)
 at a.pK.run(slb:70)

The lines it refers to in my code:

71:

Code:
targetNpc.interact("Attack", targetNpc.getName())

77:

Code:
BresenhamPath.buildTo(targetNpc).step(true);
 
Java Warlord
Joined
Nov 17, 2014
Messages
4,906
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?
 
Joined
Nov 5, 2014
Messages
505
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?

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?
 
Engineer
Joined
Jul 28, 2013
Messages
2,776
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?
It's clearly related to the mouse code on my end. Please wait for a fix.
 
Top