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

Commit 66eba7d

Browse files
committed
Verify tabId exists before accessing on close
Auditors: @cezaraugusto
1 parent 5e81ea7 commit 66eba7d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app/browser/reducers/tabsReducer.js

+6
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,12 @@ const tabsReducer = (state, action, immutableAction) => {
147147
tabs.toggleDevTools(tabId)
148148
})
149149
} else {
150+
// This check is only needed because sometimes front end can try to close
151+
// a tabId it thinks exists but doesn't actually exist anymore.
152+
const tabValue = tabState.getByTabId(state, tabId)
153+
if (!tabValue) {
154+
break
155+
}
150156
const windowId = tabState.getWindowId(state, tabId)
151157
const nonPinnedTabs = tabState.getNonPinnedTabsByWindowId(state, windowId)
152158
const pinnedTabs = tabState.getPinnedTabsByWindowId(state, windowId)

0 commit comments

Comments
 (0)