[pango] Fix crasher in justify code



commit cc3df43e9703cc4765358ae4e9e67c8199d5c37c
Author: Behdad Esfahbod <behdad behdad org>
Date:   Fri Aug 21 13:31:45 2015 +0100

    Fix crasher in justify code
    
    Ouch!

 pango/pango-layout.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index fa6fbc5..6d6e0c1 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -5243,11 +5243,14 @@ justify_clusters (PangoLayoutLine *line,
                      /* distribute to before/after */
                      distribute_letter_spacing (adjustment, &space_left, &space_right);
 
-                     glyphs->glyphs[i-1].geometry.width    += space_left ;
-                     glyphs->glyphs[i  ].geometry.width    += space_right;
-                     glyphs->glyphs[i  ].geometry.x_offset += space_right;
-
-                     added_so_far += adjustment;
+                     if (i)
+                     {
+                       glyphs->glyphs[i-1].geometry.width    += space_left ;
+                       glyphs->glyphs[i  ].geometry.width    += space_right;
+                       glyphs->glyphs[i  ].geometry.x_offset += space_right;
+
+                       added_so_far += adjustment;
+                     }
                    }
                }
            }


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