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

Commit 5dbeacf6 authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "WeatherInfo : Catch NumberFormatException" into ics

parents 547b5fb5 a507b841
Loading
Loading
Loading
Loading
+27 −19
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ public class WeatherInfo {
    }

    private String calcDirection(Context context, String degrees) {
        try {
            int deg = Integer.parseInt(degrees);
            if (deg >= 338 || deg <= 22)
                return context.getResources().getString(R.string.weather_N);
@@ -99,9 +100,16 @@ public class WeatherInfo {
                return context.getResources().getString(R.string.weather_NW);
            else
                return "";
        } catch (NumberFormatException e) {
            return "";
        }
    }

    private String trimSpeed(String speed) {
        try {
            return String.valueOf(Math.round(Float.parseFloat(speed)));
        } catch (NumberFormatException e) {
            return "";
        }
    }
}