summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
Diffstat (limited to 'pango')
-rw-r--r--pango/pango-layout.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 9cfdeaa1..34bca4de 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -822,7 +822,8 @@ pango_layout_set_text (PangoLayout *layout,
/* NULL-terminate the text for convenience.
*/
layout->text = g_malloc (length + 1);
- memcpy (layout->text, text, length);
+ if (length > 0)
+ memcpy (layout->text, text, length);
layout->text[length] = '\0';
layout->n_chars = g_utf8_strlen (layout->text, -1);