Skip to content

Commit

Permalink
fix(devtools): check if data for commit index exists
Browse files Browse the repository at this point in the history
  • Loading branch information
jyash97 committed Mar 19, 2020
1 parent 8311cb5 commit 466d0ed
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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__) {
Expand All @@ -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],
Expand Down

0 comments on commit 466d0ed

Please sign in to comment.