From 2371f0c09f012fd5ea979c614ade626a8305cc44 Mon Sep 17 00:00:00 2001 From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> Date: Tue, 29 Aug 2023 11:58:57 -0400 Subject: [PATCH] conv-avatar: show a placeholder avatar when base64 data won't load This does not fix the issue, it's a workaround in case the image data can't load. This may be related to loading large PNGs directly from base 64 strings. Gitlab: #1329 Change-Id: I45729d10a33b8c8ad0adffb339dbcae40c4b18f9 --- src/app/utils.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/app/utils.cpp b/src/app/utils.cpp index 5a12bf33d..cbd725b87 100644 --- a/src/app/utils.cpp +++ b/src/app/utils.cpp @@ -459,11 +459,10 @@ Utils::conversationAvatar(LRCInstance* instance, auto avatarb64 = convModel->avatar(convId); if (!avatarb64.isEmpty()) { auto photo = imageFromBase64String(avatarb64, true); - if (photo.isNull()) { - qWarning() << "Invalid image for conversation " << convId; - return photo; + if (!photo.isNull()) { + return scaleAndFrame(photo, size); } - return scaleAndFrame(photo, size); + qWarning() << "Couldn't load image from base 64 data for conversation " << convId; } // Else, generate an avatar auto members = convModel->peersForConversation(convId); -- GitLab