mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 01:07:42 +00:00
Merge pull request #1305 from millmanorama/grouptreecell_npe_fix
fix NPE in GroupTreeCell by not removing null Listener
This commit is contained in:
commit
c6b2e936dd
@ -22,8 +22,8 @@ import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* The {@link OnStart} annotation tells NetBeans to invoke this class's
|
||||
* {@link OnStart#run()} method
|
||||
* The {@link org.openide.modules.OnStart} annotation tells NetBeans to invoke
|
||||
* this class's {@link OnStart#run()} method
|
||||
*/
|
||||
@org.openide.modules.OnStart
|
||||
public class OnStart implements Runnable {
|
||||
@ -31,7 +31,7 @@ public class OnStart implements Runnable {
|
||||
static private final Logger LOGGER = Logger.getLogger(OnStart.class.getName());
|
||||
|
||||
/**
|
||||
|
||||
*
|
||||
*
|
||||
* This method is invoked by virtue of the {@link OnStart} annotation on the
|
||||
* {@link ImageGalleryModule} class
|
||||
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.imagegallery.gui.navpanel;
|
||||
|
||||
import java.util.Objects;
|
||||
import static java.util.Objects.isNull;
|
||||
import java.util.Optional;
|
||||
import javafx.application.Platform;
|
||||
@ -66,11 +67,13 @@ class GroupTreeCell extends TreeCell<TreeNode> {
|
||||
@Override
|
||||
protected synchronized void updateItem(final TreeNode tNode, boolean empty) {
|
||||
//if there was a previous group, remove the listener
|
||||
Optional.ofNullable(getItem())
|
||||
.map(TreeNode::getGroup)
|
||||
.ifPresent((DrawableGroup t) -> {
|
||||
t.fileIds().removeListener(listener);
|
||||
});
|
||||
if (Objects.nonNull(listener)) {
|
||||
Optional.ofNullable(getItem())
|
||||
.map(TreeNode::getGroup)
|
||||
.ifPresent((DrawableGroup t) -> {
|
||||
t.fileIds().removeListener(listener);
|
||||
});
|
||||
}
|
||||
|
||||
super.updateItem(tNode, empty);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user