From dd048988ae524c7e16ef233056b1a44da9fd828b Mon Sep 17 00:00:00 2001 From: GeeK Date: Sun, 21 Jun 2026 14:26:36 -0400 Subject: [PATCH] Fix: Fixed `NullPointerException` when plugin descriptor is not available during startup --- CHANGELOG.md | 1 + .../net/seesharpsoft/intellij/plugins/csv/CsvPlugin.java | 5 +++-- .../seesharpsoft/intellij/plugins/csv/CsvPluginManager.java | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4346f5a..742072c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ ### Fixed +- Fixed `NullPointerException` when plugin descriptor is not available during startup - Fixed `NoClassDefFoundError` in `CsvEditorSettings` - Fixed `java.lang.Throwable: ... Class initialization must not depend on services` by removing service access from class initializers and constructors - Fixed a `PluginException` (caused by `java.lang.IllegalArgumentException`) that occurred during early plugin initialization diff --git a/src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvPlugin.java b/src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvPlugin.java index 4dcdf6d..cfeca09 100644 --- a/src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvPlugin.java +++ b/src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvPlugin.java @@ -64,12 +64,13 @@ public void run(@NotNull ProgressIndicator progressIndicator) { doAsyncProjectMaintenance(project); NotificationGroup notificationGroup = NotificationGroupManager.getInstance().getNotificationGroup("net.seesharpsoft.intellij.plugins.csv"); - if (notificationGroup == null || CsvEditorSettings.getInstance().checkCurrentPluginVersion(CsvPluginManager.getVersion())) { + String version = CsvPluginManager.getVersion(); + if (version.isEmpty() || notificationGroup == null || CsvEditorSettings.getInstance().checkCurrentPluginVersion(version)) { return continuation; } Notification notification = notificationGroup.createNotification( - "CSV Editor " + CsvPluginManager.getVersion() + " - Change Notes", + "CSV Editor " + version + " - Change Notes", CsvPluginManager.getChangeNotes() + "

You can always customize plugin settings to your likings (shortcuts below)!

" + "
" + diff --git a/src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvPluginManager.java b/src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvPluginManager.java index 308e7af..57d08b3 100644 --- a/src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvPluginManager.java +++ b/src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvPluginManager.java @@ -30,11 +30,13 @@ public static IdeaPluginDescriptor getPluginDescriptor() { } public static String getVersion() { - return getPluginDescriptor().getVersion(); + IdeaPluginDescriptor descriptor = getPluginDescriptor(); + return descriptor == null ? "" : descriptor.getVersion(); } public static String getChangeNotes() { - return getPluginDescriptor().getChangeNotes(); + IdeaPluginDescriptor descriptor = getPluginDescriptor(); + return descriptor == null ? "" : descriptor.getChangeNotes(); } private CsvPluginManager() {