Explorar o código

Avatar update: Handle receivers without avatar attribute (#708)

It's possible that `receiver.avatar` is null or undefined, this can
cause a TypeError.
Danilo Bargen %!s(int64=6) %!d(string=hai) anos
pai
achega
e621ecebee
Modificáronse 1 ficheiros con 5 adicións e 5 borrados
  1. 5 5
      src/services/webclient.ts

+ 5 - 5
src/services/webclient.ts

@@ -2940,11 +2940,11 @@ export class WebClientService {
             return;
         }
 
-        // Set low-res avatar
-        receiver.avatar.low = data;
-
-        // Invalidate high-res avatar
-        receiver.avatar.high = undefined;
+        // Set (or clear) low-res avatar, invalidate high-res avatar
+        receiver.avatar = {
+            low: hasValue(data) ? data : undefined,
+            high: undefined,
+        };
     }
 
     /**