Handle properly null avatar
authorKevin Ottens <kevin.ottens@nextcloud.com>
Mon, 6 Jul 2020 12:16:28 +0000 (14:16 +0200)
committerKevin Ottens <ervin@ipsquad.net>
Tue, 7 Jul 2020 16:07:33 +0000 (18:07 +0200)
If we try to produce the avatar before we managed to connect we'd end up
trying to paint in a null image. Just return early, which will allow the
caller to do something else instead.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
src/libsync/networkjobs.cpp

index 2236b1f950de4aab06bc7634520b2fffde862710..24f27056cb2b3eb2f50e07bb2312be35efbb01f2 100644 (file)
@@ -649,6 +649,10 @@ void AvatarJob::start()
 
 QImage AvatarJob::makeCircularAvatar(const QImage &baseAvatar)
 {
+    if (baseAvatar.isNull()) {
+        return {};
+    }
+
     int dim = baseAvatar.width();
 
     QImage avatar(dim, dim, QImage::Format_ARGB32);