summaryrefslogtreecommitdiff
path: root/src/cairo-quartz-font.c
diff options
context:
space:
mode:
authorVladimir Vukicevic <vladimir@pobox.com>2008-07-09 13:06:23 -0700
committerVladimir Vukicevic <vladimir@sleet.vlad1.com>2008-07-09 13:06:23 -0700
commite534b0bed1bcf19017f76ee3a15bb26f42717b50 (patch)
treefb3d272c56a4d5c6852893c4be5554584fa98174 /src/cairo-quartz-font.c
parent7127089fe67690db997f86fd89b71820aa4fcdf0 (diff)
[quartz] Protect against NULL from CGFontGetHMetricsPtr
Seems to happen on 10.4 only for unknown reasons. Protect against a crash at least.
Diffstat (limited to 'src/cairo-quartz-font.c')
-rw-r--r--src/cairo-quartz-font.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cairo-quartz-font.c b/src/cairo-quartz-font.c
index ee5e52b8..c4df88a5 100644
--- a/src/cairo-quartz-font.c
+++ b/src/cairo-quartz-font.c
@@ -188,6 +188,12 @@ _cairo_quartz_font_face_scaled_font_create (void *abstract_face,
quartz_CGFontMetrics *m;
m = CGFontGetHMetricsPtr (font_face->cgFont);
+ /* On OX 10.4, GetHMetricsPtr sometimes returns NULL for unknown reasons */
+ if (!m) {
+ status = _cairo_error(CAIRO_STATUS_NULL_POINTER);
+ goto FINISH;
+ }
+
fs_metrics.ascent = (m->ascent / ems);
fs_metrics.descent = - (m->descent / ems);
fs_metrics.height = fs_metrics.ascent + fs_metrics.descent + (m->leading / ems);