diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/accounts/Accounts.java b/Core/src/org/sleuthkit/autopsy/datamodel/accounts/Accounts.java index febfe9ef76..6f5a83c56d 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/accounts/Accounts.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/accounts/Accounts.java @@ -1044,8 +1044,8 @@ final public class Accounts implements AutopsyVisitableItem { private BINNode(BinResult bin) { super(Children.LEAF); - setChildren(Children.createLazy(CreditCardNumberFactory::new)); this.bin = bin; + setChildren(Children.createLazy(CreditCardNumberFactory::new)); setName(getBinRangeString()); updateDisplayName(); this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/bank.png"); //NON-NLS @@ -1364,18 +1364,27 @@ final public class Accounts implements AutopsyVisitableItem { */ if (newStatus == BlackboardArtifact.ReviewStatus.REJECTED && showRejected == false) { List siblings = Arrays.asList(node.getParentNode().getChildren().getNodes()); - int indexOf = siblings.indexOf(node); - //there is no previous for the first node, so instead we select the next one - Node sibling = indexOf > 0 - ? siblings.get(indexOf - 1) - : siblings.get(indexOf + 1); - createPath = NodeOp.createPath(sibling, null); + if (siblings.size() > 1) { + int indexOf = siblings.indexOf(node); + //there is no previous for the first node, so instead we select the next one + Node sibling = indexOf > 0 + ? siblings.get(indexOf - 1) + : siblings.get(Integer.max(indexOf + 1, siblings.size() - 1)); + createPath = NodeOp.createPath(sibling, null); + } else { + /* if there are no other siblings to select, + * just return null, but note we need to filter + * this out of stream below */ + return null; + } } else { createPath = NodeOp.createPath(node, null); } //for the reselect to work we need to strip off the first part of the path. return Arrays.copyOfRange(createPath, 1, createPath.length); - }).collect(Collectors.toList()); + }) + .filter(Objects::nonNull) + .collect(Collectors.toList()); //change status of selected artifacts final Collection artifacts = Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class);