From 20211609c59a6be2d503f27e4ad0036a329bbcc1 Mon Sep 17 00:00:00 2001 From: Ykkrosh Date: Wed, 23 Jun 2004 16:00:19 +0000 Subject: [PATCH] Added tolerance for whitespace, to fix assert This was SVN commit r593. --- source/gui/CGUI.cpp | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/source/gui/CGUI.cpp b/source/gui/CGUI.cpp index 800a4c75d6..061b6f99e4 100755 --- a/source/gui/CGUI.cpp +++ b/source/gui/CGUI.cpp @@ -1111,24 +1111,27 @@ void CGUI::Xerces_ReadObject(DOMElement *pElement, IGUIObject *pParent) { CStr caption = XMLTranscode( child->getNodeValue() ); - // Text is only okay if it's the first element i.e. caption ... - if (i==0) - { - // Thank you CStr =) - caption.Trim(PS_TRIM_BOTH); + caption = caption.Trim(PS_TRIM_BOTH); - try + if (caption.Length()) + { + // Text is only okay if it's the first element i.e. caption ... + if (i==0) { - // Set the setting caption to this - object->SetSetting("caption", caption); - } - catch (...) - { - // There is no harm if the object didn't have a "caption" + + try + { + // Set the setting caption to this + object->SetSetting("caption", caption); + } + catch (...) + { + // There is no harm if the object didn't have a "caption" + } } + else + debug_warn("Text is only okay if it's the first element i.e. caption ... "); } - else - debug_warn("Text is only okay if it's the first element i.e. caption ... "); } }