Catch possible exceptions when settings change.
This commit is contained in:
parent
26f9216a8a
commit
3daf7cd247
1 changed files with 10 additions and 4 deletions
|
@ -8,6 +8,7 @@ import java.util.LinkedHashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.osmand.LogUtil;
|
||||
import net.osmand.Version;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.access.RelativeDirectionStyle;
|
||||
|
@ -381,11 +382,16 @@ public class OsmandSettings {
|
|||
|
||||
@Override
|
||||
protected E getValue(SharedPreferences prefs, E defaultValue) {
|
||||
try {
|
||||
int i = prefs.getInt(getId(), -1);
|
||||
if(i < 0 || i >= values.length){
|
||||
return defaultValue;
|
||||
}
|
||||
return values[i];
|
||||
} catch (Exception e) {
|
||||
android.util.Log.e(LogUtil.TAG, "Error getting value for: " + this.getId(), e);
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue