fixed returning reference to temp object

TODO: change signiture to return boost::optional<std::string const&> and fix crufty logic
This commit is contained in:
artemp 2014-05-28 11:04:47 +01:00
parent 4ef9cd8b45
commit 5654759a22

View file

@ -338,6 +338,7 @@ T xml_node::get_attr(std::string const& name) const
std::string const& xml_node::get_text() const
{
// FIXME : return boost::optional<std::string const&>
if (children_.empty())
{
if (is_text_)
@ -346,7 +347,8 @@ std::string const& xml_node::get_text() const
}
else
{
return "";
const static std::string empty;
return empty;
}
}
if (children_.size() == 1)