Skip to content

Commit dd04898

Browse files
committed
Fix: Fixed NullPointerException when plugin descriptor is not available during startup
1 parent 1c35a63 commit dd04898

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
### Fixed
2222

23+
- Fixed `NullPointerException` when plugin descriptor is not available during startup
2324
- Fixed `NoClassDefFoundError` in `CsvEditorSettings`
2425
- Fixed `java.lang.Throwable: ... Class initialization must not depend on services` by removing service access from class initializers and constructors
2526
- Fixed a `PluginException` (caused by `java.lang.IllegalArgumentException`) that occurred during early plugin initialization

src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvPlugin.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,13 @@ public void run(@NotNull ProgressIndicator progressIndicator) {
6464
doAsyncProjectMaintenance(project);
6565

6666
NotificationGroup notificationGroup = NotificationGroupManager.getInstance().getNotificationGroup("net.seesharpsoft.intellij.plugins.csv");
67-
if (notificationGroup == null || CsvEditorSettings.getInstance().checkCurrentPluginVersion(CsvPluginManager.getVersion())) {
67+
String version = CsvPluginManager.getVersion();
68+
if (version.isEmpty() || notificationGroup == null || CsvEditorSettings.getInstance().checkCurrentPluginVersion(version)) {
6869
return continuation;
6970
}
7071

7172
Notification notification = notificationGroup.createNotification(
72-
"CSV Editor " + CsvPluginManager.getVersion() + " - Change Notes",
73+
"CSV Editor " + version + " - Change Notes",
7374
CsvPluginManager.getChangeNotes() +
7475
"<p>You can always <b>customize plugin settings</b> to your likings (shortcuts below)!</p>" +
7576
"<br>" +

src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvPluginManager.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ public static IdeaPluginDescriptor getPluginDescriptor() {
3030
}
3131

3232
public static String getVersion() {
33-
return getPluginDescriptor().getVersion();
33+
IdeaPluginDescriptor descriptor = getPluginDescriptor();
34+
return descriptor == null ? "" : descriptor.getVersion();
3435
}
3536

3637
public static String getChangeNotes() {
37-
return getPluginDescriptor().getChangeNotes();
38+
IdeaPluginDescriptor descriptor = getPluginDescriptor();
39+
return descriptor == null ? "" : descriptor.getChangeNotes();
3840
}
3941

4042
private CsvPluginManager() {

0 commit comments

Comments
 (0)