Fix search infinite loop on not foundo
parent
0926d7cc00
commit
15eaf59503
|
@ -67,6 +67,8 @@ namespace blt {
|
|||
while (true) {
|
||||
if (searchNode->payload == element)
|
||||
return searchNode;
|
||||
if (searchNode->left == nullptr && searchNode->right == nullptr)
|
||||
return nullptr;
|
||||
// check for left and right tree traversal if it exists
|
||||
if (searchNode->left != nullptr && element < searchNode->left->payload) {
|
||||
*parent = searchNode;
|
||||
|
|
Loading…
Reference in New Issue