Skip to content

Commit d2fecd2

Browse files
committed
Only try to load services if required.
If the serviceClasses Collection is empty, there is no reason to create a ServiceHelper.
1 parent dbc00b5 commit d2fecd2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,11 @@ public Context(final Collection<Class<? extends Service>> serviceClasses,
272272

273273
setStrict(strict);
274274

275-
final ServiceHelper serviceHelper =
276-
new ServiceHelper(this, serviceClasses, strict);
277-
serviceHelper.loadServices();
275+
if (!serviceClasses.isEmpty()){
276+
final ServiceHelper serviceHelper =
277+
new ServiceHelper(this, serviceClasses, strict);
278+
serviceHelper.loadServices();
279+
}
278280
}
279281

280282
// -- Context methods --

0 commit comments

Comments
 (0)