Avoid crash when git commit title cannot be found

Avoids a crash when there is no git commit title,
because e.g. called outside a git checkout.

Change-Id: Icf8e943a75b59adff51028dd2973ed34d80a4e69