From 5ddc5aa552c654db283a5d278484c02a8819b040 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Thu, 8 Mar 2012 17:23:40 +0000 Subject: [PATCH] Prevent segfaults in mythuicheckbox if the theme xml is missing required components. --- mythtv/libs/libmythui/mythuicheckbox.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mythtv/libs/libmythui/mythuicheckbox.cpp b/mythtv/libs/libmythui/mythuicheckbox.cpp index 49984730caf..99e4ea7618c 100644 --- a/mythtv/libs/libmythui/mythuicheckbox.cpp +++ b/mythtv/libs/libmythui/mythuicheckbox.cpp @@ -73,7 +73,8 @@ void MythUICheckBox::toggleCheckState() void MythUICheckBox::SetCheckState(MythUIStateType::StateType state) { m_currentCheckState = state; - m_CheckState->DisplayState(state); + if (m_CheckState) + m_CheckState->DisplayState(state); if (state == MythUIStateType::Off) emit DependChanged(true); @@ -117,7 +118,8 @@ void MythUICheckBox::Select() return; m_state = "selected"; - m_BackgroundState->DisplayState(m_state); + if (m_BackgroundState) + m_BackgroundState->DisplayState(m_state); } void MythUICheckBox::Deselect() @@ -127,19 +129,22 @@ void MythUICheckBox::Deselect() else m_state = "disabled"; - m_BackgroundState->DisplayState(m_state); + if (m_BackgroundState) + m_BackgroundState->DisplayState(m_state); } void MythUICheckBox::Enable() { m_state = "active"; - m_BackgroundState->DisplayState(m_state); + if (m_BackgroundState) + m_BackgroundState->DisplayState(m_state); } void MythUICheckBox::Disable() { m_state = "disabled"; - m_BackgroundState->DisplayState(m_state); + if (m_BackgroundState) + m_BackgroundState->DisplayState(m_state); } /** \brief Mouse click/movement handler, receives mouse gesture events from the