Fix Settings crash when setting only decimal point to data usage warning

Settings app crashes when only decimal point (".") is set to
data usage warning because it is not a valid number.
To fix this issue, the decimal point should be converted to 0.

Fixes: 63787824
Test: manual - go to Settings > Data usage > Mobile data usage and then
               set only decimal point to data usage warning.

Change-Id: Iefb6a035ba6f17b8e0c89f79dbd397e2356fb19c
This commit is contained in:
Pengfei Zhao
2017-02-10 17:32:53 +08:00
committed by Yoshinori Hirano
parent abcd256842
commit c05a3a0227

View File

@@ -275,7 +275,7 @@ public class BillingCycleSettings extends DataUsageBase implements
Spinner spinner = (Spinner) mView.findViewById(R.id.size_spinner); Spinner spinner = (Spinner) mView.findViewById(R.id.size_spinner);
String bytesString = bytesField.getText().toString(); String bytesString = bytesField.getText().toString();
if (bytesString.isEmpty()) { if (bytesString.isEmpty() || bytesString.equals(".")) {
bytesString = "0"; bytesString = "0";
} }
final long bytes = (long) (Float.valueOf(bytesString) final long bytes = (long) (Float.valueOf(bytesString)