From bf0d8c5e902fc04d93d090333b42dedc4fb7a8a5 Mon Sep 17 00:00:00 2001 From: "simon.kagstrom" Date: Tue, 9 Feb 2010 19:08:16 +0000 Subject: [PATCH] Handle selection of None correctly --- Src/gui/theme_menu.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Src/gui/theme_menu.cpp b/Src/gui/theme_menu.cpp index 028c520..b93995e 100644 --- a/Src/gui/theme_menu.cpp +++ b/Src/gui/theme_menu.cpp @@ -36,16 +36,21 @@ public: virtual void selectCallback(int which) { - char *p = xstrdup(this->pp_msgs[this->cur_sel]); + const char *msg = this->pp_msgs[this->cur_sel]; - p[strlen(p) - 1] = '\0'; - if (!Gui::gui->setTheme(p + 1)) + if (strcmp(msg, "None") != 0) { - /* Something is wrong, reset to default */ - Gui::gui->setTheme("default"); - Gui::gui->pushDialogueBox(new DialogueBox(broken_theme_dlg)); + char *p = xstrdup(msg); + + p[strlen(p) - 1] = '\0'; + if (!Gui::gui->setTheme(p + 1)) + { + /* Something is wrong, reset to default */ + Gui::gui->setTheme("default"); + Gui::gui->pushDialogueBox(new DialogueBox(broken_theme_dlg)); + } + free(p); } - free(p); Gui::gui->popView(); }