mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-02-28 10:11:52 +01:00
[#837] Prevent NPE related to Processing
Fixed NPE when a null runnable was given to Processing. This occurs when Geolocation gathering is off and register processing adds a null instead of the IP processor.
This commit is contained in:
parent
8161488747
commit
3f5551ffaa
@ -63,7 +63,7 @@ public class Processing implements SubSystem {
|
||||
}
|
||||
|
||||
public void submitNonCritical(Runnable runnable) {
|
||||
if (nonCriticalExecutor.isShutdown()) {
|
||||
if (runnable == null || nonCriticalExecutor.isShutdown()) {
|
||||
return;
|
||||
}
|
||||
CompletableFuture.supplyAsync(() -> {
|
||||
@ -73,6 +73,7 @@ public class Processing implements SubSystem {
|
||||
}
|
||||
|
||||
public void submitCritical(Runnable runnable) {
|
||||
if (runnable == null) return;
|
||||
CompletableFuture.supplyAsync(() -> {
|
||||
runnable.run();
|
||||
return true;
|
||||
@ -87,7 +88,7 @@ public class Processing implements SubSystem {
|
||||
}
|
||||
|
||||
public <T> Future<T> submitNonCritical(Callable<T> task) {
|
||||
if (nonCriticalExecutor.isShutdown()) {
|
||||
if (task == null || nonCriticalExecutor.isShutdown()) {
|
||||
return null;
|
||||
}
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
@ -114,6 +115,7 @@ public class Processing implements SubSystem {
|
||||
}
|
||||
|
||||
public <T> Future<T> submitCritical(Callable<T> task) {
|
||||
if (task == null) return null;
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
try {
|
||||
return task.call();
|
||||
@ -139,6 +141,7 @@ public class Processing implements SubSystem {
|
||||
List<Runnable> criticalTasks = criticalExecutor.shutdownNow();
|
||||
logger.info(locale.get().getString(PluginLang.DISABLED_PROCESSING, criticalTasks.size()));
|
||||
for (Runnable runnable : criticalTasks) {
|
||||
if (runnable == null) continue;
|
||||
try {
|
||||
runnable.run();
|
||||
} catch (Exception | NoClassDefFoundError | NoSuchMethodError | NoSuchFieldError e) {
|
||||
|
Loading…
Reference in New Issue
Block a user