From 466d0ed5f215f667b5c73fc6ce66caebed69713b Mon Sep 17 00:00:00 2001 From: jyash97 Date: Thu, 19 Mar 2020 23:43:26 +0530 Subject: [PATCH] fix(devtools): check if data for commit index exists --- .../devtools/views/Profiler/CommitTreeBuilder.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/react-devtools-shared/src/devtools/views/Profiler/CommitTreeBuilder.js b/packages/react-devtools-shared/src/devtools/views/Profiler/CommitTreeBuilder.js index e122465c617e3..45f8fc1600cf4 100644 --- a/packages/react-devtools-shared/src/devtools/views/Profiler/CommitTreeBuilder.js +++ b/packages/react-devtools-shared/src/devtools/views/Profiler/CommitTreeBuilder.js @@ -79,9 +79,12 @@ export function getCommitTree({ // Construct the initial tree. recursivelyInitializeTree(rootID, 0, nodes, dataForRoot); - // Mutate the tree - if (operations != null && commitIndex < operations.length) { + if ( + operations != null && + commitIndex < operations.length && + operations[commitIndex] + ) { const commitTree = updateTree({nodes, rootID}, operations[commitIndex]); if (__DEBUG__) { @@ -98,7 +101,11 @@ export function getCommitTree({ rootID, }); - if (operations != null && commitIndex < operations.length) { + if ( + operations != null && + commitIndex < operations.length && + operations[commitIndex] + ) { const commitTree = updateTree( previousCommitTree, operations[commitIndex],