From 183d3c3ca4acb68edafc2a7ac537ca4406d79c7f Mon Sep 17 00:00:00 2001 From: Lyubomir Marinov Date: Fri, 10 Feb 2017 00:47:55 -0600 Subject: [PATCH] Fix a possible undefined state usage --- react/features/background/middleware.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/react/features/background/middleware.js b/react/features/background/middleware.js index 07e374ec2..debdbd09a 100644 --- a/react/features/background/middleware.js +++ b/react/features/background/middleware.js @@ -33,10 +33,10 @@ import { MiddlewareRegistry } from '../base/redux'; MiddlewareRegistry.register(store => next => action => { switch (action.type) { case _SET_APP_STATE_LISTENER: { - const bgState = store.getState()['features/background']; + const { appStateListener } = store.getState()['features/background']; - if (bgState.appStateListener) { - AppState.removeEventListener('change', bgState.listener); + if (appStateListener) { + AppState.removeEventListener('change', appStateListener); } if (action.listener) { AppState.addEventListener('change', action.listener);