mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
Only hold controllersByCaseLock when using controllersByCase.
Prevent NPE in DrawableFile.
This commit is contained in:
parent
89fb28da30
commit
5802fb0faa
@ -192,12 +192,15 @@ public final class ImageGalleryController {
|
||||
* @param theCase The case.
|
||||
*/
|
||||
static void shutDownController(Case theCase) {
|
||||
ImageGalleryController controller = null;
|
||||
synchronized (controllersByCaseLock) {
|
||||
if (controllersByCase.containsKey(theCase.getName())) {
|
||||
ImageGalleryController controller = controllersByCase.remove(theCase.getName());
|
||||
controller.shutDown();
|
||||
controller = controllersByCase.remove(theCase.getName());
|
||||
}
|
||||
}
|
||||
if (controller != null) {
|
||||
controller.shutDown();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -106,7 +106,14 @@ public abstract class DrawableFile {
|
||||
this.analyzed = new SimpleBooleanProperty(analyzed);
|
||||
this.file = file;
|
||||
|
||||
ImageGalleryController controllerForCase = ImageGalleryController.getController(Case.getCurrentCase());
|
||||
if (controllerForCase != null) {
|
||||
categoryManager = ImageGalleryController.getController(Case.getCurrentCase()).getCategoryManager();
|
||||
} else {
|
||||
// If getting the controller fails it means the case is currently closing. No need to
|
||||
// print an error.
|
||||
categoryManager = null;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract boolean isVideo();
|
||||
@ -246,6 +253,12 @@ public abstract class DrawableFile {
|
||||
* Update the category property.
|
||||
*/
|
||||
private void updateCategory() {
|
||||
// This only happens when a DrawableFile is created while the case is closing. No need
|
||||
// to display the error message.
|
||||
if (categoryManager == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
List<ContentTag> contentTags = getContentTags();
|
||||
TagName tag = null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user