mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
adding local files: handle case when listFiles() returns null
This commit is contained in:
parent
84e6791e02
commit
d929a6793b
@ -197,7 +197,8 @@ public class FileManager implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for receiving notifications on folders being added via a callback
|
||||
* Interface for receiving notifications on folders being added via a
|
||||
* callback
|
||||
*/
|
||||
public interface FileAddProgressUpdater {
|
||||
|
||||
@ -304,12 +305,18 @@ public class FileManager implements Closeable {
|
||||
if (isDir) {
|
||||
//create virtual folder
|
||||
final VirtualDirectory childVd = tskCase.addVirtualDirectory(parentVd.getId(), childLocalFile.getName());
|
||||
if (childVd != null && addProgressUpdater != null ) {
|
||||
if (childVd != null && addProgressUpdater != null) {
|
||||
addProgressUpdater.fileAdded(childVd);
|
||||
}
|
||||
//add children recursively
|
||||
for (java.io.File childChild : childLocalFile.listFiles()) {
|
||||
addLocalDirectoryRecInt(childVd, childChild, addProgressUpdater);
|
||||
final java.io.File[] childrenFiles = childLocalFile.listFiles();
|
||||
if (childrenFiles != null) {
|
||||
for (java.io.File childChild : childrenFiles) {
|
||||
addLocalDirectoryRecInt(childVd, childChild, addProgressUpdater);
|
||||
}
|
||||
} else {
|
||||
//add leaf file, base case
|
||||
this.addLocalFileSingle(childLocalFile.getAbsolutePath(), parentVd);
|
||||
}
|
||||
} else {
|
||||
//add leaf file, base case
|
||||
@ -428,7 +435,7 @@ public class FileManager implements Closeable {
|
||||
* closed
|
||||
*
|
||||
*/
|
||||
private synchronized LocalFile addLocalFileSingle(String localAbsPath, AbstractFile parentFile ) throws TskCoreException {
|
||||
private synchronized LocalFile addLocalFileSingle(String localAbsPath, AbstractFile parentFile) throws TskCoreException {
|
||||
|
||||
if (tskCase == null) {
|
||||
throw new TskCoreException("Attempted to use FileManager after it was closed.");
|
||||
|
Loading…
x
Reference in New Issue
Block a user