Fix for JENKINS-17409: looselyMatches throws exception if second parameter (repository) is null

https://issues.jenkins-ci.org/browse/JENKINS-17409