From 4168a07310f8e48f6dc9646588d0cf3e1c6bcc90 Mon Sep 17 00:00:00 2001 From: Dees Troy Date: Fri, 29 Nov 2013 05:01:51 +0000 Subject: Fix render issue when button has conditional If the button has a conditional, the image render function will return a 0 which indicated that an image was present even if it was not if the condition was not being met during boot. When the condition is met, mButtonImg was not set to NULL causing a render request failure. Change-Id: I32be0ddcdc1bf7ad22440d66018ef09484280afa --- gui/button.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/gui/button.cpp b/gui/button.cpp index 3f9c2df1f..be52c277e 100644 --- a/gui/button.cpp +++ b/gui/button.cpp @@ -58,15 +58,19 @@ GUIButton::GUIButton(xml_node<>* node) if (!node) return; - // Three of the four can be loaded directly from the node - mButtonImg = new GUIImage(node); + // These can be loaded directly from the node mButtonLabel = new GUIText(node); mAction = new GUIAction(node); - if (mButtonImg->Render() < 0) + child = node->first_node("image"); + if (child) { - delete mButtonImg; - mButtonImg = NULL; + mButtonImg = new GUIImage(node); + if (mButtonImg->Render() < 0) + { + delete mButtonImg; + mButtonImg = NULL; + } } if (mButtonLabel->Render() < 0) { -- cgit v1.2.3