From 819f13fb3bb961e730e199093800d5ccb24c88d6 Mon Sep 17 00:00:00 2001 From: Michael Gratton Date: Sun, 21 Jul 2019 10:59:30 +1000 Subject: [PATCH] Don't attempt to get the last initial if no other word Fixs a test failure s390, powerpc. See #512, #724 --- src/client/util/util-avatar.vala | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/client/util/util-avatar.vala b/src/client/util/util-avatar.vala index d6c0ff6b..01075160 100644 --- a/src/client/util/util-avatar.vala +++ b/src/client/util/util-avatar.vala @@ -89,10 +89,12 @@ namespace Util.Avatar { // Get the first alphanumeric char of the last word of the string index = normalized.last_index_of_char(' '); - for (int i = 0; normalized.get_next_char(ref index, out c); i++) { - if (c.isalnum()) { - buf.append_unichar(c); - break; + if (index >= 0) { + for (int i = 0; normalized.get_next_char(ref index, out c); i++) { + if (c.isalnum()) { + buf.append_unichar(c); + break; + } } }