diff --git a/source/net/filebot/ui/rename/RenameAction.java b/source/net/filebot/ui/rename/RenameAction.java index 45c0960b..bcd52eaa 100644 --- a/source/net/filebot/ui/rename/RenameAction.java +++ b/source/net/filebot/ui/rename/RenameAction.java @@ -160,13 +160,13 @@ class RenameAction extends AbstractAction { File destinationFolder = resolve(s, d).getParentFile(); // destination folder is the source, or is inside the source folder - if (destinationFolder.getPath().startsWith(sourceFolder.getPath())) { + if (d.getParentFile() == null || destinationFolder.getPath().startsWith(sourceFolder.getPath())) { return; } try { // guess affected folder depth - int tailSize = listStructurePathTail(s).size(); + int tailSize = listStructurePathTail(d.getParentFile()).size(); for (int i = 0; i < tailSize && !isStructureRoot(sourceFolder); sourceFolder = sourceFolder.getParentFile(), i++) { File[] children = sourceFolder.listFiles();