Skip to content

Commit

Permalink
fix(api): wait loading application before testing nul (#3530)
Browse files Browse the repository at this point in the history
  • Loading branch information
sguiheux authored and bnjjj committed Nov 5, 2018
1 parent 9805b22 commit 67a90ea
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions engine/api/workflow/hook.go
Expand Up @@ -299,10 +299,6 @@ func DefaultPayload(ctx context.Context, db gorp.SqlExecutor, store cache.Store,
return nil, nil
}

if wf.Root.Context.Application == nil {
return wf.Root.Context.DefaultPayload, nil
}

var defaultPayload interface{}
// Load application if not available
if wf.Root.Context != nil && wf.Root.Context.Application == nil && wf.Root.Context.ApplicationID != 0 {
Expand All @@ -313,6 +309,10 @@ func DefaultPayload(ctx context.Context, db gorp.SqlExecutor, store cache.Store,
wf.Root.Context.Application = app
}

if wf.Root.Context.Application == nil {
return wf.Root.Context.DefaultPayload, nil
}

if wf.Root.Context.Application.RepositoryFullname != "" {
defaultBranch := "master"
projectVCSServer := repositoriesmanager.GetProjectVCSServer(p, wf.Root.Context.Application.VCSServer)
Expand Down

0 comments on commit 67a90ea

Please sign in to comment.