aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/avatar_image.vala
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2019-06-11 14:46:50 +0200
committerMarvin W <git@larma.de>2019-07-09 15:25:41 +0200
commite3d994db1a25ce03ff0621876bf25319dfcbb4ad (patch)
tree6e55b12e5d83e621bfc7f6279a1d0c0bacc4f192 /main/src/ui/avatar_image.vala
parentc32990dff19c17936a6b55085f9b1b513b37e39d (diff)
downloaddino-e3d994db1a25ce03ff0621876bf25319dfcbb4ad.tar.gz
dino-e3d994db1a25ce03ff0621876bf25319dfcbb4ad.zip
Handle ill-prepared avatar image
Diffstat (limited to 'main/src/ui/avatar_image.vala')
-rw-r--r--main/src/ui/avatar_image.vala4
1 files changed, 2 insertions, 2 deletions
diff --git a/main/src/ui/avatar_image.vala b/main/src/ui/avatar_image.vala
index 846bf0ff..d98e5baa 100644
--- a/main/src/ui/avatar_image.vala
+++ b/main/src/ui/avatar_image.vala
@@ -40,11 +40,11 @@ public class AvatarImage : Misc {
Cairo.Surface buffer = new Cairo.Surface.similar(ctx.get_target(), Cairo.Content.COLOR_ALPHA, width, height);
Cairo.Context bufctx = new Cairo.Context(buffer);
if (idx == -1 || current_avatars[idx] == null) {
- set_source_hex_color(bufctx, gray || idx == -1 ? "555753" : Util.get_avatar_hex_color(stream_interactor, account, current_jids[idx]));
+ set_source_hex_color(bufctx, gray || idx == -1 || current_jids[idx] == null ? "555753" : Util.get_avatar_hex_color(stream_interactor, account, current_jids[idx]));
bufctx.rectangle(0, 0, width, height);
bufctx.fill();
- string text = text_only ?? (idx == -1 ? "…" : Util.get_display_name(stream_interactor, current_jids[idx], account).get_char(0).toupper().to_string());
+ string text = text_only ?? (idx == -1 || current_jids[idx] == null ? "…" : Util.get_display_name(stream_interactor, current_jids[idx], account).get_char(0).toupper().to_string());
bufctx.select_font_face(get_pango_context().get_font_description().get_family(), Cairo.FontSlant.NORMAL, Cairo.FontWeight.NORMAL);
bufctx.set_font_size(width / font_factor < 40 ? font_factor * 17 : font_factor * 25);
Cairo.TextExtents extents;