File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -881,7 +881,7 @@ func MergePullRequest(ctx *context.APIContext) {
881
881
882
882
if form .DeleteBranchAfterMerge {
883
883
var headRepo * git.Repository
884
- if pr . HeadRepoID == pr .BaseRepoID {
884
+ if ctx . Repo != nil && ctx . Repo . Repository != nil && ctx . Repo . Repository . ID == pr .HeadRepoID && ctx . Repo . GitRepo != nil {
885
885
headRepo = ctx .Repo .GitRepo
886
886
} else {
887
887
headRepo , err = git .OpenRepository (pr .HeadRepo .RepoPath ())
Original file line number Diff line number Diff line change @@ -968,7 +968,7 @@ func MergePullRequest(ctx *context.Context) {
968
968
969
969
if form .DeleteBranchAfterMerge {
970
970
var headRepo * git.Repository
971
- if pr .HeadRepoID == ctx .Repo .Repository .ID {
971
+ if ctx . Repo != nil && ctx . Repo . Repository != nil && pr .HeadRepoID == ctx .Repo .Repository .ID && ctx . Repo . GitRepo != nil {
972
972
headRepo = ctx .Repo .GitRepo
973
973
} else {
974
974
headRepo , err = git .OpenRepository (pr .HeadRepo .RepoPath ())
@@ -1189,7 +1189,7 @@ func CleanUpPullRequest(ctx *context.Context) {
1189
1189
var gitBaseRepo * git.Repository
1190
1190
1191
1191
// Assume that the base repo is the current context (almost certainly)
1192
- if ctx .Repo != nil && ctx .Repo .Repository .ID == pr .BaseRepoID && ctx .Repo .GitRepo != nil {
1192
+ if ctx .Repo != nil && ctx .Repo .Repository != nil && ctx . Repo . Repository .ID == pr .BaseRepoID && ctx .Repo .GitRepo != nil {
1193
1193
gitBaseRepo = ctx .Repo .GitRepo
1194
1194
} else {
1195
1195
// If not just open it
You can’t perform that action at this time.
0 commit comments