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