Skip to content

Commit

Permalink
Added missing null check.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlemstra committed Feb 11, 2017
1 parent 9c52e5b commit 7f2dc7a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions coders/psd.c
Expand Up @@ -1284,8 +1284,11 @@ static MagickBooleanType ReadPSDChannel(Image *image,
}
mask=CloneImage(image,layer_info->mask.page.width,
layer_info->mask.page.height,MagickFalse,exception);
mask->matte=MagickFalse;
channel_image=mask;
if (mask != (Image *) NULL)
{
mask->matte=MagickFalse;
channel_image=mask;
}
}

offset=TellBlob(image);
Expand Down

2 comments on commit 7f2dc7a

@setharnold
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If CloneImage returns NULL here should the rest of the computation even continue?

Thanks

@dlemstra
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point. Decided to ignore the mask when it could not be allocated but might be better to throw an exception.

Please sign in to comment.