Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,9 @@ private Decider createDecider(PollForDecisionTaskResponse decisionTask) throws E
.setExecution(decisionTask.getWorkflowExecution());
GetWorkflowExecutionHistoryResponse getHistoryResponse =
service.GetWorkflowExecutionHistory(getHistoryRequest);
if (getHistoryResponse.getHistory().getEventsSize() == 0) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Bug: Potential NPE on getHistoryResponse.getHistory() not guarded

The new check calls getHistoryResponse.getHistory().getEventsSize() but does not guard against getHistory() itself returning null. The original NPE described in the PR was on a similar chain (decisionTask.getHistory().getEvents().get(0)...). If the server returns a response with a null History field, this new code will throw an NPE instead of the intended RuntimeException.

Additionally, the same null risk exists on line 268 (decisionTask.getHistory().getEvents()) before the sticky check — if decisionTask.getHistory() is null, the method crashes before ever reaching the new guard. This is pre-existing, but worth noting since the PR aims to harden this path.

Suggested fix:

if (getHistoryResponse == null
    || getHistoryResponse.getHistory() == null
    || getHistoryResponse.getHistory().getEventsSize() == 0) {
  throw new RuntimeException("Failed to get workflow execution history for replay");
}

Was this helpful? React with 👍 / 👎 | Reply gitar fix to apply this suggestion

throw new RuntimeException("Failed to get workflow execution history for replay");
}
decisionTask.setHistory(getHistoryResponse.getHistory());
decisionTask.setNextPageToken(getHistoryResponse.getNextPageToken());
}
Expand Down
Loading