Skip to content

Commit 1a754f9

Browse files
committed
Avoid NPE when plugin cannot be instantiated
When there is a problem creating a wrapper plugin, we should just skip it -- not crash and burn. Closes #195. Thanks to Jonathan Hale for catching this.
1 parent 35163f8 commit 1a754f9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/org/scijava/plugin/AbstractWrapperService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public boolean supports(final DT data) {
7878
private <D extends DT> PT findWrapper(final D data) {
7979
for (final PluginInfo<PT> plugin : getPlugins()) {
8080
final PT instance = getPluginService().createInstance(plugin);
81-
if (instance.supports(data)) return instance;
81+
if (instance != null && instance.supports(data)) return instance;
8282
}
8383
return null;
8484
}

0 commit comments

Comments
 (0)