From e5c20792648a1b0468392303f5fa1a11d0bb05c7 Mon Sep 17 00:00:00 2001 From: crschnick Date: Wed, 1 May 2024 19:00:00 +0000 Subject: [PATCH] Fix NPEs --- .../xpipe/app/browser/file/BrowserQuickAccessContextMenu.java | 4 ++++ .../main/java/io/xpipe/ext/base/browser/EditFileAction.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/xpipe/app/browser/file/BrowserQuickAccessContextMenu.java b/app/src/main/java/io/xpipe/app/browser/file/BrowserQuickAccessContextMenu.java index fd5336534..44a0caef2 100644 --- a/app/src/main/java/io/xpipe/app/browser/file/BrowserQuickAccessContextMenu.java +++ b/app/src/main/java/io/xpipe/app/browser/file/BrowserQuickAccessContextMenu.java @@ -65,6 +65,10 @@ public class BrowserQuickAccessContextMenu extends ContextMenu { getItems().clear(); ThreadHelper.runFailableAsync(() -> { var entry = base.get(); + if (entry == null) { + return; + } + if (entry.getRawFileEntry().resolved().getKind() != FileKind.DIRECTORY) { return; } diff --git a/ext/base/src/main/java/io/xpipe/ext/base/browser/EditFileAction.java b/ext/base/src/main/java/io/xpipe/ext/base/browser/EditFileAction.java index b9af1979b..2fad4284d 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/browser/EditFileAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/browser/EditFileAction.java @@ -37,7 +37,7 @@ public class EditFileAction implements LeafAction { @Override public ObservableValue getName(OpenFileSystemModel model, List entries) { var e = AppPrefs.get().externalEditor().getValue(); - return AppI18n.observable("editWithEditor", e.toTranslatedString().getValue()); + return AppI18n.observable("editWithEditor", e != null ? e.toTranslatedString().getValue() : "?"); } @Override