[cairo] Harden the text API against NULL strings.

Handle NULL strings in cairo_show_(text|glyph),
cairo_(text|glyph)_(extents|path) without crashing.
This commit is contained in:
Chris Wilson 2008-01-12 10:30:15 +00:00
parent 864dab828b
commit 6cc75cfe5b

View file

@ -3019,6 +3019,9 @@ cairo_text_path (cairo_t *cr, const char *utf8)
if (cr->status)
return;
if (utf8 == NULL)
return;
cairo_get_current_point (cr, &x, &y);
status = _cairo_gstate_text_to_glyphs (cr->gstate, utf8,
@ -3076,6 +3079,9 @@ cairo_glyph_path (cairo_t *cr, const cairo_glyph_t *glyphs, int num_glyphs)
if (cr->status)
return;
if (num_glyphs == 0)
return;
status = _cairo_gstate_glyph_path (cr->gstate,
glyphs, num_glyphs,
cr->path);