From df45724d152972305a473c34f9a4fdda14f8ced0 Mon Sep 17 00:00:00 2001 From: spixx Date: Sat, 11 Nov 2006 13:15:43 +0000 Subject: [PATCH] * Check for missing attribute --- src/xmlstructure.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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; } -- 2.34.1