Fix error when viewing merge request with a commit that includes "Closes #<issue id>".
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/488 was giving a 500 error, and the logs showed this was the error.
I'm not yet sure why project would be nil
in this case, but that's another issue.
cc @rspeicher