Skip to content

Commit b8d1624

Browse files
committed
Fix panic when comment is nil
1 parent d1a3bd6 commit b8d1624

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

services/issue/pull.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ func PullRequestCodeOwnersReviewSpecialCommits(ctx context.Context, pr *issues_m
145145
log.Warn("Failed add assignee user: %s to PR review: %s#%d, error: %s", u.Name, pr.BaseRepo.Name, pr.ID, err)
146146
return nil, err
147147
}
148+
if comment == nil { // comment maybe nil if review type is ReviewTypeRequest
149+
continue
150+
}
148151
notifiers = append(notifiers, &ReviewRequestNotifier{
149152
Comment: comment,
150153
IsAdd: true,
@@ -158,6 +161,9 @@ func PullRequestCodeOwnersReviewSpecialCommits(ctx context.Context, pr *issues_m
158161
log.Warn("Failed add assignee team: %s to PR review: %s#%d, error: %s", t.Name, pr.BaseRepo.Name, pr.ID, err)
159162
return nil, err
160163
}
164+
if comment == nil { // comment maybe nil if review type is ReviewTypeRequest
165+
continue
166+
}
161167
notifiers = append(notifiers, &ReviewRequestNotifier{
162168
Comment: comment,
163169
IsAdd: true,

0 commit comments

Comments
 (0)