From: anthony Date: Wed, 12 Oct 2011 07:44:13 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~6836 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d181ea017cf8f75cf4e0d9acbba03e0924740050;p=imagemagick --- diff --git a/MagickCore/artifact.c b/MagickCore/artifact.c index 9693c7fac..885645051 100644 --- a/MagickCore/artifact.c +++ b/MagickCore/artifact.c @@ -439,11 +439,15 @@ MagickExport MagickBooleanType SetImageArtifact(Image *image, if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image->filename); + + /* Create tree if needed */ if (image->artifacts == (void *) NULL) image->artifacts=NewSplayTree(CompareSplayTreeString, RelinquishMagickMemory,RelinquishMagickMemory); + /* Delete artifact if NULL or empty */ if ((value == (const char *) NULL) || (*value == '\0')) return(DeleteImageArtifact(image,artifact)); + /* add option to tree */ status=AddValueToSplayTree((SplayTreeInfo *) image->artifacts, ConstantString(artifact),ConstantString(value)); return(status); diff --git a/MagickCore/option.c b/MagickCore/option.c index 6301fea2b..eb0b7b855 100644 --- a/MagickCore/option.c +++ b/MagickCore/option.c @@ -2512,10 +2512,6 @@ MagickExport MagickBooleanType SetImageOption(ImageInfo *image_info, (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image_info->filename); - /* Delete Option if NULL */ - if (value == (const char *) NULL) - return(DeleteImageOption(image_info,option)); - /* This should not be here! - but others might */ if (LocaleCompare(option,"size") == 0) (void) CloneString(&image_info->size,value); @@ -2525,6 +2521,10 @@ MagickExport MagickBooleanType SetImageOption(ImageInfo *image_info, image_info->options=NewSplayTree(CompareSplayTreeString, RelinquishMagickMemory,RelinquishMagickMemory); + /* Delete Option if NULL */ + if (value == (const char *) NULL) + return(DeleteImageOption(image_info,option)); + /* add option and return */ return(AddValueToSplayTree((SplayTreeInfo *) image_info->options, ConstantString(option),ConstantString(value)));