Ensure that pusher is not nil preventing panic in push (#13945)
PR #13381 refactored notification actions to call NotifyCreateRef and NotifyDeleteRef in a slightly different manner. This leads to the pusher not being set before the call. This PR ensures that the pusher is updated before the call. Fix #13940 Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
parent
160f606a15
commit
f2f99a7d0c
|
@ -97,6 +97,12 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
|
||||||
}
|
}
|
||||||
var commits = &repo_module.PushCommits{}
|
var commits = &repo_module.PushCommits{}
|
||||||
if opts.IsTag() { // If is tag reference {
|
if opts.IsTag() { // If is tag reference {
|
||||||
|
if pusher == nil || pusher.ID != opts.PusherID {
|
||||||
|
var err error
|
||||||
|
if pusher, err = models.GetUserByID(opts.PusherID); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
tagName := opts.TagName()
|
tagName := opts.TagName()
|
||||||
if opts.IsDelRef() {
|
if opts.IsDelRef() {
|
||||||
delTags = append(delTags, tagName)
|
delTags = append(delTags, tagName)
|
||||||
|
|
Loading…
Reference in New Issue