Fix possible StringIndexOutOfBoundsException

This commit is contained in:
Vitaliy 2020-05-12 13:37:10 +03:00
parent 74a732edf9
commit 0e12424179

View file

@ -428,7 +428,10 @@ public class BinaryMapIndexReader {
if (ls.endsWith("_2")) {
ls = ls.substring(0, ls.length() - "_2".length());
}
return ls.substring(0, ls.lastIndexOf('_')).replace('_', ' ');
if (ls.lastIndexOf('_') != -1) {
ls = ls.substring(0, ls.lastIndexOf('_')).replace('_', ' ');
}
return ls;
}
}