Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
check for the active frame before updating tabPage
Browse files Browse the repository at this point in the history
Auditors: @bbondy
fix #11028
  • Loading branch information
cezaraugusto committed Sep 23, 2017
1 parent b051f3d commit 1301ad9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/renderer/reducers/frameReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,13 @@ const frameReducer = (state, action, immutableAction) => {
state = frameStateUtil.updateFramesInternalIndex(state, Math.min(sourceFrameIndex, index))
state = frameStateUtil.moveFrame(state, tabId, index)

// Update tab page index to the active tab in case the active tab changed
const activeFrame = frameStateUtil.getActiveFrame(state)
state = frameStateUtil.updateTabPageIndex(state, activeFrame.get('tabId'))
// avoid the race-condition of updating the tabPage
// while active frame is not yet defined
if (activeFrame) {
// Update tab page index to the active tab in case the active tab changed
state = frameStateUtil.updateTabPageIndex(state, activeFrame.get('tabId'))
}
state = frameStateUtil.setPreviewFrameKey(state, null)
}

Expand Down

0 comments on commit 1301ad9

Please sign in to comment.