Skip to content

Commit 3f9353e

Browse files
committed
Context: allow null PluginIndex
If a null PluginIndex is passed to the constructor, a new vanilla PluginIndex is instantiated and used.
1 parent aeda49d commit 3f9353e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/org/scijava/Context.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public Context(final Class... serviceClasses) {
119119
* {@link Service} interface (e.g., {@code DisplayService.class}).
120120
*/
121121
public Context(final Collection<Class<? extends Service>> serviceClasses) {
122-
this(serviceClasses, new PluginIndex());
122+
this(serviceClasses, null);
123123
}
124124

125125
/**
@@ -172,8 +172,8 @@ public Context(final Collection<Class<? extends Service>> serviceClasses,
172172
{
173173
serviceIndex = new ServiceIndex();
174174

175-
this.pluginIndex = pluginIndex;
176-
pluginIndex.discover();
175+
this.pluginIndex = pluginIndex == null ? new PluginIndex() : pluginIndex;
176+
this.pluginIndex.discover();
177177

178178
final ServiceHelper serviceHelper = new ServiceHelper(this, serviceClasses);
179179
serviceHelper.loadServices();

0 commit comments

Comments
 (0)