From 20fb82282b474d3b7165b7d858562213b881ccb2 Mon Sep 17 00:00:00 2001 From: Nihal Singh Date: Thu, 30 Oct 2025 15:06:49 +0530 Subject: [PATCH] fix: prevent NPE by adding null check for JFileChooser initialization --- .../club/bytecodeviewer/gui/components/FileChooser.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/FileChooser.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/FileChooser.java index a658886ae..cbf9b42de 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/FileChooser.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/FileChooser.java @@ -46,6 +46,11 @@ public static JFileChooser create(File file, String title, String description, S public static JFileChooser create(boolean skipFileFilter, File file, String title, String description, String... extensions) throws ExecutionException, InterruptedException { JFileChooser chooser = SINGLETON.get(); + if (chooser == null) { + System.err.println("Error: JFileChooser not initialized properly — skipping export."); + return null; + } + Set extensionSet = new HashSet<>(Arrays.asList(extensions));