Don't attempt to get the last initial if no other word

Fixs a test failure s390, powerpc.

See #512, #724
This commit is contained in:
Michael Gratton 2019-07-21 10:59:30 +10:00 committed by Michael James Gratton
parent bc0c31d962
commit 819f13fb3b

View file

@ -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;
}
}
}