diff --git a/src/main/java/com/google/devtools/build/lib/runtime/UiStateTracker.java b/src/main/java/com/google/devtools/build/lib/runtime/UiStateTracker.java index 84ff8f1f0a1e17..d2fd4d3e45c158 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/UiStateTracker.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/UiStateTracker.java @@ -530,6 +530,11 @@ private ActionState getActionState( return activeActions.computeIfAbsent(actionId, (key) -> new ActionState(action, nanoTimeNow)); } + @Nullable + private ActionState getActionStateIfPresent(Artifact actionId) { + return activeActions.get(actionId); + } + void actionStarted(ActionStartedEvent event) { Action action = event.getAction(); Artifact actionId = action.getPrimaryOutput(); @@ -586,7 +591,10 @@ void actionProgress(ActionProgressEvent event) { ActionExecutionMetadata action = event.action(); Artifact actionId = event.action().getPrimaryOutput(); long now = clock.nanoTime(); - getActionState(action, actionId, now).onProgressEvent(event, now); + ActionState actionState = getActionStateIfPresent(actionId); + if (actionState != null) { + actionState.onProgressEvent(event, now); + } } void actionCompletion(ActionScanningCompletedEvent event) {