From cfe9e44b97efcf0c37125963f1508437c724fec0 Mon Sep 17 00:00:00 2001 From: jmillman Date: Fri, 5 Jun 2015 15:24:20 -0400 Subject: [PATCH] prevent index out of bounds during multiselect --- .../src/org/sleuthkit/autopsy/imagegallery/gui/GroupPane.java | 4 ++-- .../autopsy/imagegallery/gui/SingleDrawableViewBase.java | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/GroupPane.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/GroupPane.java index 880cb023d3..71d7c44ab5 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/GroupPane.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/GroupPane.java @@ -781,9 +781,9 @@ public class GroupPane extends BorderPane implements GroupView { if (shiftDown) { //TODO: do more hear to implement slicker multiselect int endIndex = grouping.get().fileIds().indexOf(newFileID); - int startIndex = IntStream.of(0, grouping.get().fileIds().size(), selectionAnchorIndex, endIndex).min().getAsInt(); + int startIndex = IntStream.of(grouping.get().fileIds().size(), selectionAnchorIndex, endIndex).min().getAsInt(); endIndex = IntStream.of(0, selectionAnchorIndex, endIndex).max().getAsInt(); - List subList = grouping.get().fileIds().subList(startIndex, endIndex + 1); + List subList = grouping.get().fileIds().subList(Math.max(0, startIndex), Math.min(endIndex, grouping.get().fileIds().size()) + 1); globalSelectionModel.clearAndSelectAll(subList.toArray(new Long[subList.size()])); globalSelectionModel.select(newFileID); diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/SingleDrawableViewBase.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/SingleDrawableViewBase.java index 61e5611415..7d3a55a365 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/SingleDrawableViewBase.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/SingleDrawableViewBase.java @@ -255,6 +255,7 @@ public abstract class SingleDrawableViewBase extends AnchorPane implements Drawa protected abstract String getLabelText(); + @SuppressWarnings("deprecation") protected void initialize() { followUpToggle.setOnAction((ActionEvent t) -> { if (followUpToggle.isSelected() == true) {