Updater: Handle NumberFormatException
* For cases like local Updates (not yet merged) and probably others, the parsing might fail and take down the Updater * Handle NFE properly Change-Id: If9609c59d1048c9d37aa6de90855e02f28d96ce2
This commit is contained in:
@@ -415,7 +415,12 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getDisplayVersion(String version) {
|
public static String getDisplayVersion(String version) {
|
||||||
float floatVersion = Float.parseFloat(version);
|
float floatVersion = 0;
|
||||||
|
try {
|
||||||
|
floatVersion = Float.parseFloat(version);
|
||||||
|
} catch (NumberFormatException ignored) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
// Lineage 20 and up should only be integer values (we don't have minor versions anymore)
|
// Lineage 20 and up should only be integer values (we don't have minor versions anymore)
|
||||||
return (floatVersion >= 20) ? String.valueOf((int)floatVersion) : version;
|
return (floatVersion >= 20) ? String.valueOf((int)floatVersion) : version;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user