diff --git a/src/devtools/views/Components/TreeContext.js b/src/devtools/views/Components/TreeContext.js index 4e09ab4e02..a2dcd63f65 100644 --- a/src/devtools/views/Components/TreeContext.js +++ b/src/devtools/views/Components/TreeContext.js @@ -407,7 +407,7 @@ function reduceOwnersState(store: Store, state: State, action: Action): State { ownerStackIndex = ownerStack.length - 1; } } - if (selectedElementID !== null) { + if (selectedElementID !== null && _ownerFlatTree !== null) { // Mutation might have caused the index of this ID to shift. selectedElementIndex = _ownerFlatTree.indexOf(selectedElementID); }