From aebca55d7ab25584872a9a0acbb3e4530759d31d Mon Sep 17 00:00:00 2001
From: Adam Niedzielski <adamsunday@gmail.com>
Date: Mon, 21 Nov 2016 15:21:18 +0100
Subject: [PATCH] Return valid response in
 Projects::MergeRequestsController#ci_status when diff_head_sha is nil

---
 app/controllers/projects/merge_requests_controller.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb
index 016d16721f6..fa74a002a64 100644
--- a/app/controllers/projects/merge_requests_controller.rb
+++ b/app/controllers/projects/merge_requests_controller.rb
@@ -417,7 +417,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
 
     response = {
       title: merge_request.title,
-      sha: merge_request.diff_head_commit.short_id,
+      sha: (merge_request.diff_head_commit.short_id if merge_request.diff_head_sha),
       status: status,
       coverage: coverage
     }
-- 
GitLab