X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fxmlstructure.cpp;h=278f270cf2513e0bbaeb6c3cd33a5dfd0125fbb3;hb=df45724d152972305a473c34f9a4fdda14f8ced0;hp=b7466c0c560278ededb44427e6280a34846ce0da;hpb=15c82487a77555b040f3f4e03bc11da8b9bc5905;p=lsystem3d.git diff --git a/src/xmlstructure.cpp b/src/xmlstructure.cpp index b7466c0..278f270 100644 --- a/src/xmlstructure.cpp +++ b/src/xmlstructure.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2006 Erik Dahlberg // -// This file is part of LSystem3d. +// This file is part of LSystem3D. // // LSystem3D is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -21,6 +21,7 @@ #include +#include #include #include #include @@ -42,7 +43,7 @@ XMLStructure::XMLStructure() _rootElement = NULL; _activeElement = NULL; _activeDocument = NULL; - _activeChildInList = NULL; + _activeChildInList = (xmlpp::Node::NodeList::iterator)NULL; } @@ -225,7 +226,13 @@ string XMLStructure::getAttribute(string name) xmlpp::Element *child = dynamic_cast(*_activeChildInList); // its attribute value - string attributeValue = child->get_attribute(name)->get_value(); + string attributeValue; + xmlpp::Attribute *attribute = child->get_attribute(name); + + if (attribute) + { + attributeValue = attribute->get_value(); + } return attributeValue; }