From 0ecbb71bee44abc42140ab43580e1346b9dc4d71 Mon Sep 17 00:00:00 2001 From: qwerty287 <80460567+qwerty287@users.noreply.github.com> Date: Sun, 4 Sep 2022 17:12:37 +0200 Subject: [PATCH] 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 --- modules/convert/issue_comment.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/convert/issue_comment.go b/modules/convert/issue_comment.go index ccc94b2496..73ad345fa4 100644 --- a/modules/convert/issue_comment.go +++ b/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) }