From 4d8f18742b5dc1563f58867604e215a7685df411 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 3 Nov 2017 18:43:43 +0000 Subject: [PATCH] Check against non-existant promise to resolve a user's groups --- src/stores/FlairStore.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/stores/FlairStore.js b/src/stores/FlairStore.js index 411065eee0..587890da7f 100644 --- a/src/stores/FlairStore.js +++ b/src/stores/FlairStore.js @@ -128,12 +128,16 @@ class FlairStore extends EventEmitter { } catch (err) { // Propagate the same error to all usersInFlight Object.keys(this._usersInFlight).forEach((userId) => { + // The promise should always exist for userId, but do a null-check anyway + if (!this._usersInFlight[userId]) return; this._usersInFlight[userId].reject(err); }); return; } const updatedUserGroups = resp.users; Object.keys(this._usersInFlight).forEach((userId) => { + // The promise should always exist for userId, but do a null-check anyway + if (!this._usersInFlight[userId]) return; this._usersInFlight[userId].resolve(updatedUserGroups[userId] || []); }); }