Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e1d4698f authored by Brian Muramatsu's avatar Brian Muramatsu
Browse files

Fix Settings getFloat Methods

Don't pass null to Float.parseFloat, because that throws a NPE.
Check for null and throw SettingNotFoundException to fulfill
what the JavaDoc says.

Change-Id: Iff742fb3c15be6e02f29b9dda9197dc05a867924
parent 03b758ef
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -977,6 +977,9 @@ public final class Settings {
        public static float getFloat(ContentResolver cr, String name)
                throws SettingNotFoundException {
            String v = getString(cr, name);
            if (v == null) {
                throw new SettingNotFoundException(name);
            }
            try {
                return Float.parseFloat(v);
            } catch (NumberFormatException e) {
@@ -2296,6 +2299,9 @@ public final class Settings {
        public static float getFloat(ContentResolver cr, String name)
                throws SettingNotFoundException {
            String v = getString(cr, name);
            if (v == null) {
                throw new SettingNotFoundException(name);
            }
            try {
                return Float.parseFloat(v);
            } catch (NumberFormatException e) {