Fix nil pointer panic when exec some gitea cli command (#28791)
panic: ![image](https://github.com/go-gitea/gitea/assets/18380374/7fcde2ad-1d42-4b60-b120-3b60a8926e8e) After: ![image](https://github.com/go-gitea/gitea/assets/18380374/49d9f0ca-e590-4a35-8ca2-1317d1b7c939)
This commit is contained in:
parent
5d3fdd1212
commit
c7e4629c02
3 changed files with 9 additions and 0 deletions
|
@ -22,5 +22,8 @@ func GenerateActionsRunnerToken(ctx context.Context, scope string) (string, Resp
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, extra := requestJSONResp(req, &responseText{})
|
resp, extra := requestJSONResp(req, &responseText{})
|
||||||
|
if resp == nil {
|
||||||
|
return "", extra
|
||||||
|
}
|
||||||
return resp.Text, extra
|
return resp.Text, extra
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,5 +27,8 @@ func AuthorizedPublicKeyByContent(ctx context.Context, content string) (string,
|
||||||
req := newInternalRequest(ctx, reqURL, "POST")
|
req := newInternalRequest(ctx, reqURL, "POST")
|
||||||
req.Param("content", content)
|
req.Param("content", content)
|
||||||
resp, extra := requestJSONResp(req, &responseText{})
|
resp, extra := requestJSONResp(req, &responseText{})
|
||||||
|
if resp == nil {
|
||||||
|
return "", extra
|
||||||
|
}
|
||||||
return resp.Text, extra
|
return resp.Text, extra
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,5 +30,8 @@ func SendEmail(ctx context.Context, subject, message string, to []string) (strin
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, extra := requestJSONResp(req, &responseText{})
|
resp, extra := requestJSONResp(req, &responseText{})
|
||||||
|
if resp == nil {
|
||||||
|
return "", extra
|
||||||
|
}
|
||||||
return resp.Text, extra
|
return resp.Text, extra
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue