From a615eae0816555030edf5e4dad48305e66669c6e Mon Sep 17 00:00:00 2001 From: dirk Date: Tue, 6 Aug 2013 20:15:36 +0000 Subject: [PATCH] Profile method now returns an empty blob if the profile with the specified name could not be found. --- Magick++/lib/Image.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/Magick++/lib/Image.cpp b/Magick++/lib/Image.cpp index 80ca70a09..74c5b9693 100644 --- a/Magick++/lib/Image.cpp +++ b/Magick++/lib/Image.cpp @@ -4061,17 +4061,11 @@ void Magick::Image::profile( const std::string name_, // an existing generic profile name. Magick::Blob Magick::Image::profile( const std::string name_ ) const { - const MagickCore::Image* image = constImage(); - - const StringInfo * profile = GetImageProfile( image, name_.c_str() ); - - if ( profile != (StringInfo *) NULL) - return Blob( (void*) GetStringInfoDatum(profile), GetStringInfoLength(profile)); - - Blob blob; - Image temp_image = *this; - temp_image.write( &blob, name_ ); - return blob; + const StringInfo * profile = GetImageProfile( constImage(), name_.c_str() ); + + if ( profile == (StringInfo *) NULL) + return Blob( 0, 0 ); + return Blob( (void*) GetStringInfoDatum(profile), GetStringInfoLength(profile)); } void Magick::Image::quality ( const size_t quality_ ) -- 2.40.0