From: spixx Date: Sat, 11 Nov 2006 13:15:43 +0000 (+0000) Subject: * Check for missing attribute X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=df45724d152972305a473c34f9a4fdda14f8ced0;p=lsystem3d.git * Check for missing attribute --- diff --git a/src/xmlstructure.cpp b/src/xmlstructure.cpp index f2832c3..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 @@ -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; }