@@ -1411,13 +1411,13 @@ func (weh *workflowExecutionEventHandlerImpl) estimateHistorySize(event *m.Histo
14111411 }
14121412 case m .EventTypeDecisionTaskStarted :
14131413 if event .DecisionTaskStartedEventAttributes != nil {
1414- sum += len ( * event .DecisionTaskStartedEventAttributes .Identity )
1414+ sum += getLengthOfStringPointer ( event .DecisionTaskStartedEventAttributes .Identity )
14151415 }
14161416 case m .EventTypeDecisionTaskCompleted :
14171417 if event .DecisionTaskCompletedEventAttributes != nil {
14181418 sum += len (event .DecisionTaskCompletedEventAttributes .ExecutionContext )
1419- sum += len ( * event .DecisionTaskCompletedEventAttributes .Identity )
1420- sum += len ( * event .DecisionTaskCompletedEventAttributes .BinaryChecksum )
1419+ sum += getLengthOfStringPointer ( event .DecisionTaskCompletedEventAttributes .Identity )
1420+ sum += getLengthOfStringPointer ( event .DecisionTaskCompletedEventAttributes .BinaryChecksum )
14211421 }
14221422 case m .EventTypeDecisionTaskFailed :
14231423 if event .DecisionTaskFailedEventAttributes != nil {
@@ -1435,7 +1435,7 @@ func (weh *workflowExecutionEventHandlerImpl) estimateHistorySize(event *m.Histo
14351435 case m .EventTypeActivityTaskCompleted :
14361436 if event .ActivityTaskCompletedEventAttributes != nil {
14371437 sum += len (event .ActivityTaskCompletedEventAttributes .Result )
1438- sum += len ( * event .ActivityTaskCompletedEventAttributes .Identity )
1438+ sum += getLengthOfStringPointer ( event .ActivityTaskCompletedEventAttributes .Identity )
14391439 }
14401440 case m .EventTypeActivityTaskFailed :
14411441 if event .ActivityTaskFailedEventAttributes != nil {
@@ -1486,7 +1486,7 @@ func (weh *workflowExecutionEventHandlerImpl) estimateHistorySize(event *m.Histo
14861486 case m .EventTypeChildWorkflowExecutionFailed :
14871487 if event .ChildWorkflowExecutionFailedEventAttributes != nil {
14881488 sum += len (event .ChildWorkflowExecutionFailedEventAttributes .Details )
1489- sum += len ( * event .ChildWorkflowExecutionFailedEventAttributes .Reason )
1489+ sum += getLengthOfStringPointer ( event .ChildWorkflowExecutionFailedEventAttributes .Reason )
14901490 }
14911491 case m .EventTypeChildWorkflowExecutionCanceled :
14921492 if event .ChildWorkflowExecutionCanceledEventAttributes != nil {
@@ -1513,3 +1513,10 @@ func sizeOf(o map[string][]byte) int {
15131513 }
15141514 return sum
15151515}
1516+
1517+ func getLengthOfStringPointer (s * string ) int {
1518+ if s == nil {
1519+ return 0
1520+ }
1521+ return len (* s )
1522+ }
0 commit comments