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

Commit

Permalink
Check that appState downloads is not undefined before filtering
Browse files Browse the repository at this point in the history
Auditors: @bbondy
  • Loading branch information
diracdeltas committed Aug 9, 2016
1 parent 1e1e185 commit 034e476
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions js/stores/appStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,10 +414,12 @@ const handleAppAction = (action) => {
}
break
case AppConstants.APP_CLEAR_COMPLETED_DOWNLOADS:
const downloads = appState.get('downloads')
.filter((download) =>
![downloadStates.COMPLETED, downloadStates.INTERRUPTED, downloadStates.CANCELLED].includes(download.get('state')))
appState = appState.set('downloads', downloads)
if (appState.get('downloads')) {
const downloads = appState.get('downloads')
.filter((download) =>
![downloadStates.COMPLETED, downloadStates.INTERRUPTED, downloadStates.CANCELLED].includes(download.get('state')))
appState = appState.set('downloads', downloads)
}
break
case AppConstants.APP_CLEAR_SITES_WITHOUT_TAGS:
appState = appState.set('sites', siteUtil.clearSitesWithoutTags(appState.get('sites')))
Expand Down

0 comments on commit 034e476

Please sign in to comment.