From a45142a02d00f0771f04c1c59a13c406b4513d12 Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Mon, 20 Apr 2020 19:12:01 +1200 Subject: [PATCH] Fix exception when updating cached profile picture --- src/lib/collectors.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/collectors.js b/src/lib/collectors.js index bfe92ca..0e8ace0 100644 --- a/src/lib/collectors.js +++ b/src/lib/collectors.js @@ -173,11 +173,11 @@ function updateProfilePictureFromReel(userID) { const profilePicURL = result.reel.user.profile_pic_url if (!profilePicURL) throw constants.symbols.NOT_FOUND db.prepare("UPDATE Users SET profile_pic_url = ? WHERE user_id = ?").run(profilePicURL, userID) - for (const user of userRequestCache.cache.values()) { + for (const entry of userRequestCache.cache.values()) { // yes, data.data is correct. - if (user.data.data.id === userID) { - user.data.data.profile_pic_url = profilePicURL - user.data.computeProxyProfilePic() + if (entry.data && entry.data.data && entry.data.data.id === userID) { + entry.data.data.profile_pic_url = profilePicURL + entry.data.computeProxyProfilePic() break // stop checking entries from the cache since we won't find any more } }