From: arjen Date: Sat, 28 Sep 2002 06:48:46 +0000 (+0000) Subject: Bugfix: In configuration::find_parameter(), check if the parameter node exists X-Git-Tag: V0_3~11 X-Git-Url: http://www.andromeda.nl/gitweb/?p=AXE.git;a=commitdiff_plain;h=5e0f2b89e7e4866de0e6f57f96986f7cf65fc0e7 Bugfix: In configuration::find_parameter(), check if the parameter node exists before retrieving its contents. --- diff --git a/src/configuration.cpp b/src/configuration.cpp index 6c2b7bc..7772621 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -6,7 +6,7 @@ *********************** ** FILE NAME : configuration.cpp ** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation -** VERSION NUMBER : $Revision: 1.1 $ +** VERSION NUMBER : $Revision: 1.2 $ ** ** DESCRIPTION : Implementation of configuration class ** @@ -24,12 +24,16 @@ /***************************** $Log: configuration.cpp,v $ - Revision 1.1 2002-07-25 08:01:26 arjen + Revision 1.2 2002-09-28 06:48:46 arjen + Bugfix: In configuration::find_parameter(), check if the parameter node exists + before retrieving its contents. + + Revision 1.1 2002/07/25 08:01:26 arjen First checkin, AXE release 0.2 *****************************/ -static const char *RCSID = "$Id: configuration.cpp,v 1.1 2002-07-25 08:01:26 arjen Exp $"; +static const char *RCSID = "$Id: configuration.cpp,v 1.2 2002-09-28 06:48:46 arjen Exp $"; #include "configuration.h" @@ -78,9 +82,9 @@ bool configuration::read(const String name) if (system != NULL) { root = xmlDocGetRootElement(system); - if (app_name != (char *)root->name) + if (app_name != (const char *)root->name) { - cerr << "Wrong config file.\n"; + std::cerr << "Wrong config file.\n"; xmlFreeDoc(system); system = NULL; } @@ -89,9 +93,9 @@ bool configuration::read(const String name) if (user != NULL) { root = xmlDocGetRootElement(user); - if (app_name != (char *)root->name) + if (app_name != (const char *)root->name) { - cerr << "Wrong config file.\n"; + std::cerr << "Wrong config file.\n"; xmlFreeDoc(user); user = NULL; } @@ -165,7 +169,10 @@ String configuration::find_parameter(const String section, const String paramete if (section_node != NULL) { param_node = xmlFindTag(section_node->childs, parameter); - param_node = param_node->childs; + if (param_node != NULL) + { + param_node = param_node->childs; + } if (param_node != NULL) { param_value = (char *)param_node->content;