RaiMan / SikuliX1

SikuliX version 2.0.0+ (2019+)
https://sikulix.github.io
MIT License
2.79k stars 357 forks source link

Region class: waitBest hit IndexOutOfBoundsException #584

Open thinhdnn opened 1 year ago

thinhdnn commented 1 year ago

My cases:

  1. Bigger image is the first, and the second is the matching image. This will throw an exception.
  2. The first is the matching image, and the second is a bigger image. This will show the first image matched.

Because here. results.add((Integer) current[0], (Long) current[1]); get exception Index of outbound for case 1 Cannot add index 1 to empty list.

for (Future result : fResults) { try { Object[] current = (Object[]) result.get(); maxDuration = Math.max((Long) current[1], maxDuration); results.add((Integer) current[0], (Long) current[1]); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } }