MagickSetImageFilename is a no-op when passed a null, but returns MagickTrue?
Posted: 2019-08-29T17:21:12-07:00
Perhaps I'm reading this code wrong (I'm new to C), but from what I see, if the filename is NULL, it returns MagickTrue, as if it set the filename successfully, but it actually didn't do anything. It looks like a unintentional no-op to me.
Or maybe I'm missing something, and people should simply be smart enough not to pass a NULL in the first place
Or maybe I'm missing something, and people should simply be smart enough not to pass a NULL in the first place
Code: Select all
WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
const char *filename)
{
assert(wand != (MagickWand *) NULL);
assert(wand->signature == MagickWandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
if (wand->images == (Image *) NULL)
ThrowWandException(WandError,"ContainsNoImages",wand->name);
if (filename != (const char *) NULL)
(void) CopyMagickString(wand->images->filename,filename,MagickPathExtent);
return(MagickTrue);
}