Merge pull request #8946 from osmandapp/minor_fixes

Fix possible StringIndexOutOfBoundsException
This commit is contained in:
vshcherb 2020-05-13 16:33:37 +02:00 committed by GitHub
commit 183bcb7b03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -428,7 +428,10 @@ public class BinaryMapIndexReader {
if (ls.endsWith("_2")) { if (ls.endsWith("_2")) {
ls = ls.substring(0, ls.length() - "_2".length()); 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;
} }
} }