[geary/wip/512-s390-redux: 23/23] Don't attempt to get the last initial if no other word



commit 6f702254d4624e9e6bc472e6e9afcd91861c8cb6
Author: Michael Gratton <mike vee net>
Date:   Sun Jul 21 10:59:30 2019 +1000

    Don't attempt to get the last initial if no other word
    
    Fixs a test failure s390
    
    See #512

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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]