prevent parse int error
This commit is contained in:
parent
624edc63ee
commit
99eba591fa
1 changed files with 15 additions and 7 deletions
|
@ -457,6 +457,7 @@ public class BInstallerActivity extends AppCompatActivity {
|
||||||
if (fileName.endsWith(suffix)) {
|
if (fileName.endsWith(suffix)) {
|
||||||
String basename = fileName.substring(0, fileName.length() - suffix.length());
|
String basename = fileName.substring(0, fileName.length() - suffix.length());
|
||||||
int tileIndex = tileForBaseName(basename);
|
int tileIndex = tileForBaseName(basename);
|
||||||
|
if (tileIndex != -1) {
|
||||||
mBInstallerView.setTileStatus(tileIndex, MASK_INSTALLED_RD5);
|
mBInstallerView.setTileStatus(tileIndex, MASK_INSTALLED_RD5);
|
||||||
|
|
||||||
long age = System.currentTimeMillis() - new File(dir, fileName).lastModified();
|
long age = System.currentTimeMillis() - new File(dir, fileName).lastModified();
|
||||||
|
@ -464,6 +465,7 @@ public class BInstallerActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void deleteSelectedTiles() {
|
private void deleteSelectedTiles() {
|
||||||
ArrayList<Integer> selectedTiles = mBInstallerView.getSelectedTiles(MASK_DELETED_RD5);
|
ArrayList<Integer> selectedTiles = mBInstallerView.getSelectedTiles(MASK_DELETED_RD5);
|
||||||
|
@ -527,10 +529,16 @@ public class BInstallerActivity extends AppCompatActivity {
|
||||||
if (idx < 0) return -1;
|
if (idx < 0) return -1;
|
||||||
String slon = uname.substring(0, idx);
|
String slon = uname.substring(0, idx);
|
||||||
String slat = uname.substring(idx + 1);
|
String slat = uname.substring(idx + 1);
|
||||||
int ilon = slon.charAt(0) == 'W' ? -Integer.parseInt(slon.substring(1)) :
|
int ilon = 0;
|
||||||
|
int ilat = 0;
|
||||||
|
try {
|
||||||
|
ilon = slon.charAt(0) == 'W' ? -Integer.parseInt(slon.substring(1)) :
|
||||||
(slon.charAt(0) == 'E' ? Integer.parseInt(slon.substring(1)) : -1);
|
(slon.charAt(0) == 'E' ? Integer.parseInt(slon.substring(1)) : -1);
|
||||||
int ilat = slat.charAt(0) == 'S' ? -Integer.parseInt(slat.substring(1)) :
|
ilat = slat.charAt(0) == 'S' ? -Integer.parseInt(slat.substring(1)) :
|
||||||
(slat.charAt(0) == 'N' ? Integer.parseInt(slat.substring(1)) : -1);
|
(slat.charAt(0) == 'N' ? Integer.parseInt(slat.substring(1)) : -1);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
if (ilon < -180 || ilon >= 180 || ilon % 5 != 0) return -1;
|
if (ilon < -180 || ilon >= 180 || ilon % 5 != 0) return -1;
|
||||||
if (ilat < -90 || ilat >= 90 || ilat % 5 != 0) return -1;
|
if (ilat < -90 || ilat >= 90 || ilat % 5 != 0) return -1;
|
||||||
return (ilon + 180) / 5 + 72 * ((ilat + 90) / 5);
|
return (ilon + 180) / 5 + 72 * ((ilat + 90) / 5);
|
||||||
|
|
Loading…
Reference in a new issue