mirror of
https://github.com/go-gitea/gitea.git
synced 2026-02-21 22:18:23 +01:00
Avoid nil issue when GetIssueByID fails
Use a temporary variable so issue is only overwritten on success, preventing a nil dereference in notify_service.CreateIssueComment. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
648c1714fe
commit
82b3f5ffd5
@ -82,8 +82,10 @@ func CreateIssueComment(ctx context.Context, doer *user_model.User, repo *repo_m
|
||||
}
|
||||
|
||||
// reload issue to ensure it has the latest data, especially the number of comments
|
||||
if issue, err = issues_model.GetIssueByID(ctx, issue.ID); err != nil {
|
||||
if reloadedIssue, err := issues_model.GetIssueByID(ctx, issue.ID); err != nil {
|
||||
log.Error("GetIssueByID: %v", err)
|
||||
} else {
|
||||
issue = reloadedIssue
|
||||
}
|
||||
|
||||
notify_service.CreateIssueComment(ctx, doer, repo, issue, comment, mentions)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user