Skip to content

Commit 9ede8aa

Browse files
committed
fix: add null check for FSFile retrieval and log error if not found
1 parent 9e56bf5 commit 9ede8aa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/foam/core/fs/FSFileContentDAO.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ foam.CLASS({
3434
if ( ret != null ) return ret;
3535
3636
FSFile file = (FSFile) ((DAO) x.get("FSFileDAO")).find((String) id);
37+
if ( file == null ) {
38+
Loggers.logger(x, this).error("Error getting content: FSFile not found for id: ", (String) id);
39+
return null;
40+
}
3741
if ( file.getIsDirectory() ) {
3842
Loggers.logger(x, this).error("Error getting content: ", (String) file.getId(), "file is a directory");
3943
return null;

0 commit comments

Comments
 (0)