Skip to content

Commit b4ede5d

Browse files
committed
add IMAGICK_NOT_EMPTY macro
1 parent 3cbbc56 commit b4ede5d

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

imagickdraw_class.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -1315,8 +1315,7 @@ PHP_METHOD(ImagickDraw, composite)
13151315

13161316
intern = Z_IMAGICK_P(magick_obj);
13171317

1318-
if (php_imagick_ensure_not_empty (intern->magick_wand) == 0)
1319-
RETURN_THROWS();
1318+
IMAGICK_NOT_EMPTY(intern);
13201319

13211320
internd = Z_IMAGICKDRAW_P(getThis());
13221321
status = DrawComposite(internd->drawing_wand, compose, x, y, width, height, intern->magick_wand);

php_imagick_macros.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@
4343
#define IMAGICK_KERNEL_NOT_NULL_EMPTY(kernel) \
4444
if (kernel->kernel_info == NULL) { \
4545
zend_throw_exception(php_imagickkernel_exception_class_entry, "ImagickKernel is empty, cannot be used", (long)0 TSRMLS_CC); \
46-
RETURN_NULL(); \
46+
RETURN_THROWS(); \
4747
}
4848

49+
#define IMAGICK_NOT_EMPTY(wand) \
50+
if (php_imagick_ensure_not_empty (wand->magick_wand) == 0) { \
51+
RETURN_THROWS(); \
52+
}
53+
54+
4955
#endif /* PHP_IMAGICK_MACROS_H */

0 commit comments

Comments
 (0)