Selaa lähdekoodia

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 6 vuotta sitten
vanhempi
commit
e621ecebee
1 muutettua tiedostoa jossa 5 lisäystä ja 5 poistoa
  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,
+        };
     }
 
     /**