Reduce severity of ".." at model root

It seems more sensible to return nullptr rather than throwing an exception.
This commit is contained in:
Richard Harrison 2020-11-21 12:18:22 +01:00
parent 2cb6499f1c
commit 5d5f1779c6

View File

@ -472,8 +472,10 @@ find_node_aux(SGPropertyNode * current, SplitItr& itr, bool create,
return find_node_aux(current, ++itr, create, last_index); return find_node_aux(current, ++itr, create, last_index);
if (equals(name, "..")) { if (equals(name, "..")) {
SGPropertyNode * parent = current->getParent(); SGPropertyNode * parent = current->getParent();
if (parent == 0) if (parent == 0) {
throw std::runtime_error("attempt to move past root with '..'"); SG_LOG(SG_GENERAL, SG_ALERT, "attempt to move past root with '..' node " << current->getName());
return nullptr;
}
return find_node_aux(parent, ++itr, create, last_index); return find_node_aux(parent, ++itr, create, last_index);
} }
int index = -1; int index = -1;