Fix error when viewing merge request with a commit that includes "Closes #<issue id>".

Merged Douwe Maan requested to merge extract-closing-issues into master 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