diff options
-rw-r--r-- | lib/gitlab/git/repository.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index 77543206e13..b7965315eb2 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -1413,8 +1413,11 @@ module Gitlab end def can_be_merged?(source_sha, target_branch) - target_sha = find_branch(target_branch, true).target - !gitaly_conflicts_client(source_sha, target_sha).conflicts? + if target_sha = find_branch(target_branch, true)&.target + !gitaly_conflicts_client(source_sha, target_sha).conflicts? + else + false + end end def search_files_by_name(query, ref) |