Fix Coverity null dereferenced warning

It is probably not possible for cur to be nullptr, but best check anyway.

Closes CID 1380176
This commit is contained in:
Gregory A Lundberg 2017-09-11 14:22:08 -05:00 committed by Jyrki Vesterinen
parent 7c3d789514
commit 0bd159b8b7

View file

@ -736,10 +736,13 @@ tree_view_node* tree_view_node::get_node_above()
}
}
while(!cur->is_folded() && cur->count_children() > 0) {
while(cur && !cur->is_folded() && cur->count_children() > 0) {
cur = &cur->get_child_at(cur->count_children() - 1);
}
if (!cur)
throw std::domain_error("tree_view_node::get_node_above(): Cannot determine which node is this line, or which node is the line above this one, if any.");
return cur;
}