You've already forked sap-jenkins-library
mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-11-06 09:09:19 +02:00
fix(githubCreateIssue): prevent panic for Github error (#2914)
In case the Github connection leads to an error it can happen that a nil pointer dereference exception can occur. This is to fix this. Co-authored-by: Sven Merk <33895725+nevskrem@users.noreply.github.com>
This commit is contained in:
@@ -51,7 +51,9 @@ func runGithubCreateIssue(ctx context.Context, config *githubCreateIssueOptions,
|
||||
|
||||
newIssue, resp, err := ghCreateIssueService.Create(ctx, config.Owner, config.Repository, &issue)
|
||||
if err != nil {
|
||||
log.Entry().Errorf("GitHub response code %v", resp.Status)
|
||||
if resp != nil {
|
||||
log.Entry().Errorf("GitHub response code %v", resp.Status)
|
||||
}
|
||||
return errors.Wrap(err, "error occurred when creating issue")
|
||||
}
|
||||
log.Entry().Debugf("New issue created: %v", newIssue)
|
||||
|
||||
Reference in New Issue
Block a user