diff options
author | qwerty287 <80460567+qwerty287@users.noreply.github.com> | 2022-09-04 17:12:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-04 16:12:37 +0100 |
commit | 0ecbb71bee44abc42140ab43580e1346b9dc4d71 (patch) | |
tree | 2c55663cf1ffc464b463aba123547b8bbab7ab0a | |
parent | ea38455e1f33e132bec0d601285407e1690e54e2 (diff) | |
download | gitea-0ecbb71bee44abc42140ab43580e1346b9dc4d71.tar.gz gitea-0ecbb71bee44abc42140ab43580e1346b9dc4d71.zip |
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
-rw-r--r-- | modules/convert/issue_comment.go | 6 |
1 files changed, 6 insertions, 0 deletions
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) } |