[geary/cherry-pick-e805ac5f] Merge branch 'mjog/fix-ppc-test' into 'mainline'



commit b80b97a9951852198dd4c259647c826c80f1ce37
Author: Michael Gratton <mike vee net>
Date:   Sun Mar 15 00:19:29 2020 +0000

    Merge branch 'mjog/fix-ppc-test' into 'mainline'
    
    Don't attempt to get the last initial if no other word
    
    See merge request GNOME/geary!431
    
    (cherry picked from commit e805ac5fc5030a2c8d79baf5238bba0faf3d86ee)
    
    819f13fb Don't attempt to get the last initial if no other word

 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]