Skip to content

Commit

Permalink
check for the active frame before updating tabPage
Browse files Browse the repository at this point in the history
Auditors: @bbondy
fix brave#11028
  • Loading branch information
cezaraugusto committed Sep 23, 2017
1 parent 12f516d commit d738190
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 @@ -108,9 +108,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 d738190

Please sign in to comment.