From d965bd3d8e90e53503f0a1152da4f716c44b3639 Mon Sep 17 00:00:00 2001 From: kugel Date: Mon, 24 Aug 2009 16:12:45 +0000 Subject: [PATCH] Fix a problem spotted in FS#10543. For F_CHOICE_SETTING, an invalid value would (which may happen if the values changed e.g. due to the statusbar at bottom addition) lead to the correspong 0 value, instead of leaving the setting untouched. Fix it by not calling atoi() for F_CHOICE_SETTING (they don't have int-like values). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22499 a1c6a512-1295-4272-9138-f99709370657 --- apps/settings.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/settings.c b/apps/settings.c index 98cd6ebc9..4c16c6a0e 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -308,7 +308,13 @@ bool settings_load_config(const char* file, bool apply) *v = temp; } else - *v = atoi(value); + { /* atoi breaks choice settings because they + * don't have int-like values, and would + * fall back to the first value (i.e. 0) + * due to atoi */ + if (!(settings[i].flags&F_CHOICE_SETTING)) + *v = atoi(value); + } } break; case F_T_BOOL: -- 2.11.4.GIT