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:
Michael W
2023-06-18 11:40:41 +02:00
committed by Nolen Johnson
parent 755560bbcd
commit bf1646fa93

View File

@@ -415,7 +415,12 @@ public class Utils {
}
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)
return (floatVersion >= 20) ? String.valueOf((int)floatVersion) : version;
}