Skip to content

Commit

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

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

Fix go-gitea#21041
  • Loading branch information
qwerty287 authored 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.