Handle selection of None correctly

This commit is contained in:
simon.kagstrom 2010-02-09 19:08:16 +00:00
parent 171e274b9a
commit bf0d8c5e90

View File

@ -36,16 +36,21 @@ public:
virtual void selectCallback(int which) 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 (strcmp(msg, "None") != 0)
if (!Gui::gui->setTheme(p + 1))
{ {
/* Something is wrong, reset to default */ char *p = xstrdup(msg);
Gui::gui->setTheme("default");
Gui::gui->pushDialogueBox(new DialogueBox(broken_theme_dlg)); 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(); Gui::gui->popView();
} }