Return fallback if .as(fallback) called on a node that doesn't exist
Since 1025f76df1 it seems that missing
nodes point to a 'zombie' node, where the m_isValid member is false.
This caused .as(const S& fallback) throw an exception if the node was
missing, instead of returning the provided fallback value (as was the
behaviour previous to the above commit)
This commit is contained in:
parent
b43db54810
commit
0526d7c299
@ -149,7 +149,7 @@ inline const T Node::as() const {
|
|||||||
template <typename T, typename S>
|
template <typename T, typename S>
|
||||||
inline const T Node::as(const S& fallback) const {
|
inline const T Node::as(const S& fallback) const {
|
||||||
if (!m_isValid)
|
if (!m_isValid)
|
||||||
throw InvalidNode();
|
return fallback;
|
||||||
return as_if<T, S>(*this)(fallback);
|
return as_if<T, S>(*this)(fallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user