1
0
mirror of https://git.sr.ht/~cadence/bibliogram synced 2024-11-23 00:27:30 +00:00

Fix exception when updating cached profile picture

This commit is contained in:
Cadence Ember 2020-04-20 19:12:01 +12:00
parent 297c9a0c08
commit a45142a02d
No known key found for this signature in database
GPG Key ID: 128B99B1B74A6412

View File

@ -173,11 +173,11 @@ function updateProfilePictureFromReel(userID) {
const profilePicURL = result.reel.user.profile_pic_url const profilePicURL = result.reel.user.profile_pic_url
if (!profilePicURL) throw constants.symbols.NOT_FOUND if (!profilePicURL) throw constants.symbols.NOT_FOUND
db.prepare("UPDATE Users SET profile_pic_url = ? WHERE user_id = ?").run(profilePicURL, userID) 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. // yes, data.data is correct.
if (user.data.data.id === userID) { if (entry.data && entry.data.data && entry.data.data.id === userID) {
user.data.data.profile_pic_url = profilePicURL entry.data.data.profile_pic_url = profilePicURL
user.data.computeProxyProfilePic() entry.data.computeProxyProfilePic()
break // stop checking entries from the cache since we won't find any more break // stop checking entries from the cache since we won't find any more
} }
} }