Skip to content

Commit

Permalink
Fix possible nullptr exception when parent does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
tdrwenski committed Jun 12, 2024
1 parent 27422a6 commit bbd876d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cdm/core/src/main/java/thredds/filesystem/MFileOS.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,11 @@ public String getName() {
return file.getName();
}

@Nullable
@Override
public MFile getParent() {
return new MFileOS(file.getParentFile());
File parent = file.getParentFile();
return parent == null ? null : new MFileOS(parent);
}

@Override
Expand Down

0 comments on commit bbd876d

Please sign in to comment.