Fixed NPE if repository.getBranch() is undefined