Corrected string index out of range (JENKINS-25466)

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