Added a small fix to prevent the code from throwing an NPE if the repository is invalid