diff --git a/src/main/java/com/uber/cadence/internal/common/WorkflowExecutionUtils.java b/src/main/java/com/uber/cadence/internal/common/WorkflowExecutionUtils.java index 067c3e0b..5d9add40 100644 --- a/src/main/java/com/uber/cadence/internal/common/WorkflowExecutionUtils.java +++ b/src/main/java/com/uber/cadence/internal/common/WorkflowExecutionUtils.java @@ -226,7 +226,8 @@ private static HistoryEvent getInstanceCloseEvent( pageToken = response.getNextPageToken(); History history = response.getHistory(); - if (history != null && history.getEvents().size() > 0) { + + if (history != null && history.getEvents() != null && history.getEvents().size() > 0) { event = history.getEvents().get(0); if (!isWorkflowExecutionCompletedEvent(event)) { throw new RuntimeException("Last history event is not completion event: " + event);