]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authoranthony <anthony@git.imagemagick.org>
Wed, 12 Oct 2011 07:44:13 +0000 (07:44 +0000)
committeranthony <anthony@git.imagemagick.org>
Wed, 12 Oct 2011 07:44:13 +0000 (07:44 +0000)
MagickCore/artifact.c
MagickCore/option.c

index 9693c7fac27af1c194a8a7af2ca5dfed44f251e0..88564505179e4e9c6528fc62f484d26221103a75 100644 (file)
@@ -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);
index 6301fea2b6606cd2dd3122055bf0613ece17c417..eb0b7b8558f029fcd6a8e29dfff0889fb3df26c6 100644 (file)
@@ -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)));