Fix potential (silent) NRE when no data is available after all.

This commit is contained in:
Florian Nücke
2022-02-06 21:38:10 +01:00
parent 7a4037eb61
commit d8dc608e89

View File

@@ -282,6 +282,10 @@ public final class ProjectorLoadBalancer {
assert runningEncode == null || runningEncode.isDone();
runningEncode = ENCODER_WORKERS.submit(() -> {
final ByteBuffer frame = frameSupplier.get();
if (frame == null) {
return;
}
final int budgetCost = frame.limit() * players.size();
BUDGET.accumulateAndGet(budgetCost, (budget, cost) -> budget - cost);