Skip to content

Commit

Permalink
Avoid a potential NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
jponge committed Jun 20, 2022
1 parent a06b438 commit 935ce8b
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ public void configureMutinyInfrastructure(ExecutorService executor, ShutdownCont
MutinyScheduler mutinyScheduler = new MutinyScheduler(executor) {
@Override
protected <V> RunnableScheduledFuture<V> decorateTask(Runnable runnable, RunnableScheduledFuture<V> task) {
return super.decorateTask(runnable,
new ContextualRunnableScheduledFuture<>(contextHandler, contextHandler.captureContext(), task));
Object context = (contextHandler != null) ? contextHandler.captureContext() : null;
return super.decorateTask(runnable, new ContextualRunnableScheduledFuture<>(contextHandler, context, task));
}

@Override
protected <V> RunnableScheduledFuture<V> decorateTask(Callable<V> callable, RunnableScheduledFuture<V> task) {
return super.decorateTask(callable,
new ContextualRunnableScheduledFuture<>(contextHandler, contextHandler.captureContext(), task));
Object context = (contextHandler != null) ? contextHandler.captureContext() : null;
return super.decorateTask(callable, new ContextualRunnableScheduledFuture<>(contextHandler, context, task));
}
};
Infrastructure.setDefaultExecutor(new ScheduledExecutorService() {
Expand Down

0 comments on commit 935ce8b

Please sign in to comment.