fix(commitTreeBuilder): crash when parentNode.children is undefined#36698
fix(commitTreeBuilder): crash when parentNode.children is undefined#36698Mohammadreza-Sarvari wants to merge 2 commits into
Conversation
|
Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
Closed #36596
Dear @unstubbable @eps1lon could you please assign #36596 issue to me and review this PR? thanks.
Summary
Guard against
undefinedchildrenarray inCommitTreeBuilderwhen calling.concat()and.filter()on cloned parent nodes. This fixes a crash in the Profiler flamegraph view: "Cannot read properties of undefined (reading 'concat')" inCommitFlamegraphAutoSizer.The root cause:
getClonedNodespreads an existing node ({...existingNode}), and in some edge cases the node'schildrenfield can beundefined, causing the subsequent.concat()or.filter()call to throw.How did you test this change?
(parentNode.children || [])at both call sites (.concat()at line 258 and.filter()at line 308)..childrenaccess in the same file that could cause the same class of error.