diff --git a/src/eepp/ui/uimenucheckbox.cpp b/src/eepp/ui/uimenucheckbox.cpp index b8efbfad2..5d6f4891c 100644 --- a/src/eepp/ui/uimenucheckbox.cpp +++ b/src/eepp/ui/uimenucheckbox.cpp @@ -87,11 +87,13 @@ void UIMenuCheckBox::setActive( const bool& active ) { } if ( oActive != active ) { - UIMenu* Menu = getParent()->asType(); + if ( getParent()->isType( UI_TYPE_MENU ) ) { + UIMenu* menu = getParent()->asType(); - if ( !Menu->widgetCheckSize( this ) ) { - if ( NULL != getIcon()->getDrawable() ) { - setPadding( Rectf( 0, 0, 0, 0 ) ); + if ( !menu->widgetCheckSize( this ) ) { + if ( NULL != getIcon()->getDrawable() ) { + setPadding( Rectf( 0, 0, 0, 0 ) ); + } } } diff --git a/src/eepp/ui/uimenuradiobutton.cpp b/src/eepp/ui/uimenuradiobutton.cpp index 0379aa59e..c29ebf763 100644 --- a/src/eepp/ui/uimenuradiobutton.cpp +++ b/src/eepp/ui/uimenuradiobutton.cpp @@ -92,21 +92,23 @@ void UIMenuRadioButton::setActive( const bool& active ) { } } - UIMenu* Menu = getParent()->asType(); + if ( getParent()->isType( UI_TYPE_MENU ) ) { + UIMenu* menu = getParent()->asType(); - if ( !Menu->widgetCheckSize( this ) ) { - if ( NULL != getIcon()->getDrawable() ) { - setPadding( Rectf( 0, 0, 0, 0 ) ); - } - } - - if ( mActive ) { - Node* child = Menu->getFirstChild(); - while ( child ) { - if ( child->isType( UI_TYPE_MENURADIOBUTTON ) && child != this ) { - child->asType()->setActive( false ); + if ( !menu->widgetCheckSize( this ) ) { + if ( NULL != getIcon()->getDrawable() ) { + setPadding( Rectf( 0, 0, 0, 0 ) ); + } + } + + if ( mActive ) { + Node* child = menu->getFirstChild(); + while ( child ) { + if ( child->isType( UI_TYPE_MENURADIOBUTTON ) && child != this ) { + child->asType()->setActive( false ); + } + child = child->getNextNode(); } - child = child->getNextNode(); } }