summaryrefslogtreecommitdiff
path: root/src/cairo-font-options.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-01-17 21:11:00 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2008-01-17 21:11:00 +0000
commitb15e91d2b6c229dfe3da4a354306915cc42f75bd (patch)
treec5d7cc8097362fc8220ca2cabe18a400fa78d438 /src/cairo-font-options.c
parent630536f17681b083db658414d68db2c0eb167af3 (diff)
downloadcairo-b15e91d2b6c229dfe3da4a354306915cc42f75bd.tar.gz
[cairo-font-options] Check for a NULL cairo_font_options_t
On IRC Drakou reported a user error whereby cairo_scaled_font_create() was called with a NULL cairo_font_options_t. However, instead of reporting the error back to the user, cairo instead segfaulted trying to dereference the NULL pointer! Add a guard to check that the options is not NULL.
Diffstat (limited to 'src/cairo-font-options.c')
-rw-r--r--src/cairo-font-options.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cairo-font-options.c b/src/cairo-font-options.c
index c5d5c12b5..6b2cb08e2 100644
--- a/src/cairo-font-options.c
+++ b/src/cairo-font-options.c
@@ -161,7 +161,9 @@ slim_hidden_def (cairo_font_options_destroy);
cairo_status_t
cairo_font_options_status (cairo_font_options_t *options)
{
- if (options == (cairo_font_options_t *)&_cairo_font_options_nil)
+ if (options == NULL)
+ return CAIRO_STATUS_NULL_POINTER;
+ else if (options == (cairo_font_options_t *)&_cairo_font_options_nil)
return CAIRO_STATUS_NO_MEMORY;
else
return CAIRO_STATUS_SUCCESS;