From 768931403708f956b4f2e9cf1a2953b0d55569d5 Mon Sep 17 00:00:00 2001 From: johanengelen Date: Tue, 13 Mar 2007 22:22:36 +0000 Subject: [PATCH] Fixed [ 1678374 ]; hopefully made the optiongroup code more robust for different INX definitions. --- src/extension/paramradiobutton.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/extension/paramradiobutton.cpp b/src/extension/paramradiobutton.cpp index 3ca051f14..94270af84 100644 --- a/src/extension/paramradiobutton.cpp +++ b/src/extension/paramradiobutton.cpp @@ -77,10 +77,16 @@ ParamRadioButton::ParamRadioButton (const gchar * name, const gchar * guitext, c const char * contents = sp_repr_children(child_repr)->content(); if (contents != NULL) newguitext = new Glib::ustring(contents); + else + continue; + const char * val = child_repr->attribute("value"); if (val != NULL) newvalue = new Glib::ustring(val); - if ( (newguitext) && (newvalue) ) { + else + newvalue = new Glib::ustring(*newguitext); + + if ( (newguitext) && (newvalue) ) { // logical error if this is not true here choices = g_slist_append( choices, new optionentry(newvalue, newguitext) ); } } @@ -91,10 +97,10 @@ ParamRadioButton::ParamRadioButton (const gchar * name, const gchar * guitext, c // Initialize _value with the default value from xml // for simplicity : default to the contents of the first xml-child const char * defaultval = NULL; - if (sp_repr_children(sp_repr_children(xml)) != NULL) - defaultval = sp_repr_children(xml)->attribute("value"); + if (choices) + defaultval = ((optionentry*) choices->data)->value->c_str(); - gchar * pref_name = this->pref_name(); + gchar * pref_name = this->pref_name(); const gchar * paramval = prefs_get_string_attribute(PREF_DIR, pref_name); g_free(pref_name); -- 2.30.2