diff --git a/pandora_agents/ChangeLog b/pandora_agents/ChangeLog index 90060f0a7d..8d5252baa8 100644 --- a/pandora_agents/ChangeLog +++ b/pandora_agents/ChangeLog @@ -1,3 +1,8 @@ +2008-07-22 Ramon Novoa + + * win32/modules/pandora_module.cc: Fixed a bug that made the agent + crash when a module returned data of the wrong type. + 2008-07-17 Manuel Arostegui * linux/pandora_agent.conf: Removed enabled debug by diff --git a/pandora_agents/win32/modules/pandora_module.cc b/pandora_agents/win32/modules/pandora_module.cc index ee43cbf70a..dbd897f645 100644 --- a/pandora_agents/win32/modules/pandora_module.cc +++ b/pandora_agents/win32/modules/pandora_module.cc @@ -350,10 +350,16 @@ Pandora_Module::getXml () { data = *iter; data_element = new TiXmlElement ("data"); element = new TiXmlElement ("value"); - data_clean = strreplace (this->getDataOutput (data), "%", "%%" ); - text = new TiXmlText (data_clean); - element->InsertEndChild (*text); - data_element->InsertEndChild (*element); + try { + data_clean = strreplace (this->getDataOutput (data), "%", "%%" ); + } catch (Output_Error e) { + delete element; + continue; + } + + text = new TiXmlText (data_clean); + element->InsertEndChild (*text); + data_element->InsertEndChild (*element); delete text; delete element; @@ -372,11 +378,14 @@ Pandora_Module::getXml () { } else { data = data_list->front (); element = new TiXmlElement ("data"); - data_clean = strreplace (this->getDataOutput (data), "%", "%%" ); - text = new TiXmlText (data_clean); - element->InsertEndChild (*text); - root->InsertEndChild (*element); - delete text; + try { + data_clean = strreplace (this->getDataOutput (data), "%", "%%" ); + text = new TiXmlText (data_clean); + element->InsertEndChild (*text); + root->InsertEndChild (*element); + delete text; + } catch (Output_Error e) { + } delete element; }