Fix 500 on time in timeline API (#21052) (#21057)

Backport #21052

Before converting a TrackedTime for the API we need to load its attributes - otherwise we get an NPE.

Fix #21041
tokarchuk/v1.17
qwerty287 2 years ago committed by GitHub
parent ea38455e1f
commit 0ecbb71bee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      modules/convert/issue_comment.go

@ -101,6 +101,12 @@ func ToTimelineComment(c *issues_model.Comment, doer *user_model.User) *api.Time
}
if c.Time != nil {
err = c.Time.LoadAttributes()
if err != nil {
log.Error("Time.LoadAttributes: %v", err)
return nil
}
comment.TrackedTime = ToTrackedTime(c.Time)
}

Loading…
Cancel
Save