diff --git a/js/stores/windowStore.js b/js/stores/windowStore.js index de80cba9325..752e2a2a5e9 100644 --- a/js/stores/windowStore.js +++ b/js/stores/windowStore.js @@ -118,11 +118,9 @@ const newFrame = (state, frameOpts) => { console.debug('newFrame', frameOpts) } // Ensure valid index - let insertionIndex = frameOpts.index != null - ? frameOpts.index - : 0 + let insertionIndex = frameOpts.index const highestFrameIndex = (state.get('frames') || Immutable.List()).count() - if (insertionIndex === -1 || insertionIndex > highestFrameIndex) { + if (insertionIndex == null || insertionIndex === -1 || insertionIndex > highestFrameIndex) { if (shouldLogDebug) { console.debug(`newFrame: invalid insertionIndex of ${insertionIndex} so using max index of ${highestFrameIndex}`) }