diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 63d7d987b..d6693742f 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1598,8 +1598,7 @@ int CMenuOptionLanguageChooser::paint( bool selected ) //------------------------------------------------------------------------------------------------------------------------------- CMenuForwarder::CMenuForwarder(const neutrino_locale_t Text, const bool Active, const char * const Option, CMenuTarget* Target, const char * const ActionKey, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right) { - option = Option; - option_string = NULL; + option = (Option != NULL) ? (std::string)Option : ""; text=Text; active = Active; jumpTarget = Target; @@ -1611,8 +1610,7 @@ CMenuForwarder::CMenuForwarder(const neutrino_locale_t Text, const bool Active, CMenuForwarder::CMenuForwarder(const neutrino_locale_t Text, const bool Active, const std::string &Option, CMenuTarget* Target, const char * const ActionKey, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right) { - option = NULL; - option_string = &Option; + option = Option; text=Text; active = Active; jumpTarget = Target; @@ -1652,10 +1650,8 @@ int CMenuForwarder::getWidth(void) int tw = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(g_Locale->getText(text), true); const char * option_text = NULL; - if (option) - option_text = option; - else if (option_string) - option_text = option_string->c_str(); + if (!option.empty()) + option_text = option.c_str(); if (option_text != NULL) @@ -1678,13 +1674,10 @@ int CMenuForwarder::exec(CMenuTarget* parent) const char * CMenuForwarder::getOption(void) { - if (option) - return option; + if (!option.empty()) + return option.c_str(); else - if (option_string) - return option_string->c_str(); - else - return NULL; + return NULL; } const char * CMenuForwarder::getName(void) @@ -1756,10 +1749,8 @@ int CMenuForwarderNonLocalized::getWidth(void) { int tw = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(the_text, true); const char * option_text = NULL; - if (option) - option_text = option; - else if (option_string) - option_text = option_string->c_str(); + if (!option.empty()) + option_text = option.c_str(); if (option_text != NULL) tw += 10 + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(option_text, true); diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index 9d9eb92a1..ac4c9584f 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -198,8 +198,7 @@ class CMenuForwarder : public CMenuItem std::string actionKey; protected: - const char * option; - const std::string * option_string; + std::string option; CMenuTarget * jumpTarget; neutrino_locale_t text;