summaryrefslogtreecommitdiff
path: root/ext/gd/gd_ctx.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/gd/gd_ctx.c')
-rw-r--r--ext/gd/gd_ctx.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c
index 028a37e435..c848e438c7 100644
--- a/ext/gd/gd_ctx.c
+++ b/ext/gd/gd_ctx.c
@@ -103,7 +103,9 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
}
}
- ZEND_FETCH_RESOURCE(im, gdImagePtr, imgind, -1, "Image", phpi_get_le_gd());
+ if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(imgind), "Image", phpi_get_le_gd())) == NULL) {
+ RETURN_FALSE;
+ }
if (argc >= 3) {
q = quality; /* or colorindex for foreground of BW images (defaults to black) */