Fix possible NPE

This commit is contained in:
crschnick 2024-07-30 00:14:51 +00:00
parent ebedd332bb
commit 3996d330a6

View file

@ -99,6 +99,10 @@ public final class BrowserFileListModel {
} }
public BrowserEntry rename(BrowserEntry old, String newName) { public BrowserEntry rename(BrowserEntry old, String newName) {
if (fileSystemModel == null || fileSystemModel.isClosed() || fileSystemModel.getCurrentPath().get() == null) {
return old;
}
var fullPath = FileNames.join(fileSystemModel.getCurrentPath().get(), old.getFileName()); var fullPath = FileNames.join(fileSystemModel.getCurrentPath().get(), old.getFileName());
var newFullPath = FileNames.join(fileSystemModel.getCurrentPath().get(), newName); var newFullPath = FileNames.join(fileSystemModel.getCurrentPath().get(), newName);