Skip to content

Commit

Permalink
Fix 500 on time in timeline API (#21052) (#21057)
Browse files Browse the repository at this point in the history
Backport #21052

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

Fix #21041
  • Loading branch information
qwerty287 committed Sep 4, 2022
1 parent ea38455 commit 0ecbb71
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/convert/issue_comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 0ecbb71

Please sign in to comment.