Added protection from NullPointerException when dotGitDirectory is wrong.