Skip to content

Commit e07a2a1

Browse files
committed
Fixed bug. When @CommandHandler method has no argument(i.e. when work in progress), then no NPE should be prevented
1 parent 16cb940 commit e07a2a1

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

src/main/java/org/axonframework/intellij/ide/plugin/publisher/CommandEventPublisher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public CommandEventPublisher(PsiType psiType, PsiElement psiElement) {
1414

1515
@Override
1616
public boolean canPublishType(PsiType eventType) {
17-
return eventType.isAssignableFrom(commandType);
17+
return eventType != null && eventType.isAssignableFrom(commandType);
1818
}
1919

2020
@Override

src/main/java/org/axonframework/intellij/ide/plugin/publisher/DefaultEventPublisherProvider.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,16 @@ private void findAndRegisterAllConstructors(PsiTypeElement firstCommandHandlerAr
8080
.findClass(type.getCanonicalText(), GlobalSearchScope.allScope(project));
8181
if (parameterClass != null) {
8282
PsiMethod[] constructors = parameterClass.getConstructors();
83-
registerAllConstructorInvocations(type, constructors);
83+
if (parameterClassHasConstructor(constructors)) {
84+
registerAllConstructorInvocations(type, constructors);
85+
}
8486
}
8587
}
8688

89+
private boolean parameterClassHasConstructor(PsiMethod[] constructors) {
90+
return constructors.length > 0;
91+
}
92+
8793
private void registerAllConstructorInvocations(final PsiType type, PsiMethod[] constructors) {
8894
for (PsiMethod constructor : constructors) {
8995
Query<PsiReference> constructorCalls = MethodReferencesSearch.search(constructor);

src/main/resources/META-INF/plugin.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
</description>
1313

1414
<change-notes><![CDATA[
15+
Version 0.3.5<br />
16+
-------------<br />
17+
<ul>
18+
<li>Several bugfixes for IDEAPLUGIN-4</li>
19+
</ul>
20+
<br />
21+
<br />
1522
Version 0.3.4<br />
1623
-------------<br />
1724
<ul>

0 commit comments

Comments
 (0)