From e791b3713a8e9932e48dcb141275d11acc199538 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Thu, 15 Nov 2018 16:01:16 -0500 Subject: more error checking --- convert.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/convert.c b/convert.c index f64f7f6..1afafd0 100644 --- a/convert.c +++ b/convert.c @@ -10,8 +10,22 @@ int convert(const char *in, const char *out, int width, int height) if (!IsMagickWandInstantiated()) { MagickWandGenesis(); + } + + if (w == NULL) { w = NewMagickWand(); + if (w == NULL) { + printf("couldn't create MagickWand\n"); + return 1; + } + } + + if (pixel == NULL) { pixel = NewPixelWand(); + if (pixel == NULL) { + printf("couldn't create PixelWand\n"); + return 1; + } } if (!MagickReadImage(w, in)) { -- cgit v1.2.1