Closed
Description
Description:
pgo.getInvengetHatchery().queryHatchedEggs()
sometimes throws an indexOutOfBoundsError
. I suspect this is when an Egg has actually hatched
Steps to reproduce:
List<HatchedEgg> hatcheds = inventories.getHatchery().queryHatchedEggs();;
if (hatcheds.size() > 0) {
TAG = "HATCHERY";
for (HatchedEgg hatchedEgg : hatcheds) {
Log.i(TAG, String.format("Congrats! You hatched an %s and received %d candies and %d stardust!", Inventories.getPokebank().getPokemonById(hatchedEgg.getId()).getPokemonId().toString().toLowerCase(), hatchedEgg.getCandy(), hatchedEgg.getStardust()));
}
}
(also make sure there is an actual hatch -> implement walking code)
Expected behavior:
Print the string above or gracefully throw an error.
Actual behavior:
Crash due to IndexOutOfBoundsException
Stacktrace (If it's a crash):
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at java.util.Collections$UnmodifiableList.get(Unknown Source)
at POGOProtos.Networking.Responses.GetHatchedEggsResponseOuterClass$GetHatchedEggsResponse.getExperienceAwarded(GetHatchedEggsResponseOuterClass.java:292)
at com.pokegoapi.api.inventory.Hatchery.queryHatchedEggs(Hatchery.java:77)
at some.package.SomeClass.someMethod(SomeClass:##)
Version:
Recent Development branch.
Metadata
Metadata
Assignees
Labels
No labels