This PR fixes node path resolution when given nodeId is not defined.
Description
getPathForNodeId method didn't check whether provided nodeId is defined or not. As a result it was looking for node paths ending with '.undefined' or '.null'. If nodes with such ids exist then climbUp method was making infinite scan failing with Maximum call stack size exceeded error. When root node was reached, the climbing should stop, but instead root's undefined parent was resolved as path to node with 'undefined' id (string with 9 chars word) and climbing was continued until, again, root node was reached, and the story begins.
Motivation and Context
Having nodes with 'undefined' or 'null' ids is not common situation, and may point that similar bug (concatenating null/undefined variable with string) is somewhere in LRUD user's code. Nevertheless, 'undefined' and 'null' are fully-flagged ids that shouldn't cause infinite climbing.
How Has This Been Tested?
Fix was tested by unit tests and manually in app using LRUD library where such issue was found.
Screenshots (if appropriate):
Types of changes
[x] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
[x] My code follows the code style of this project.
[ ] My change requires a change to the documentation.
This PR fixes node path resolution when given
nodeId
is not defined.Description
getPathForNodeId
method didn't check whether providednodeId
is defined or not. As a result it was looking for node paths ending with'.undefined'
or'.null'
. If nodes with such ids exist thenclimbUp
method was making infinite scan failing withMaximum call stack size exceeded
error. Whenroot
node was reached, the climbing should stop, but insteadroot
'sundefined
parent was resolved as path to node with'undefined'
id (string with 9 chars word) and climbing was continued until, again,root
node was reached, and the story begins.Motivation and Context
Having nodes with
'undefined'
or'null'
ids is not common situation, and may point that similar bug (concatenatingnull
/undefined
variable with string) is somewhere in LRUD user's code. Nevertheless,'undefined'
and'null'
are fully-flagged ids that shouldn't cause infinite climbing.How Has This Been Tested?
Fix was tested by unit tests and manually in app using LRUD library where such issue was found.
Screenshots (if appropriate):
Types of changes
Checklist: