Git: Fix possible core dump

Change-Id: Ieb822c8810e8943d5397e6c64188690e481dd0f9
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>