From 965376663a1880d92812cf0c7965708b55aaef3b Mon Sep 17 00:00:00 2001 From: dynamicer Date: Wed, 25 Sep 2024 10:07:27 +0800 Subject: [PATCH] Update GetImageBlob/GetImagesBlob to return blob when ExceptionInfo is warning kind (#328) Co-authored-by: hejingzheng --- imagick/magick_wand_image.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/imagick/magick_wand_image.go b/imagick/magick_wand_image.go index 963b7b4..19730e1 100644 --- a/imagick/magick_wand_image.go +++ b/imagick/magick_wand_image.go @@ -941,11 +941,11 @@ func (mw *MagickWand) GetImageBlob() ([]byte, error) { clen := C.size_t(0) csblob := C.MagickGetImageBlob(mw.mw, &clen) defer relinquishMemory(unsafe.Pointer(csblob)) - if err := mw.GetLastError(); err != nil { - return nil, err - } ret := C.GoBytes(unsafe.Pointer(csblob), C.int(clen)) runtime.KeepAlive(mw) + if err := mw.GetLastError(); err != nil { + return ret, err + } return ret, nil } @@ -959,11 +959,11 @@ func (mw *MagickWand) GetImagesBlob() ([]byte, error) { clen := C.size_t(0) csblob := C.MagickGetImagesBlob(mw.mw, &clen) defer relinquishMemory(unsafe.Pointer(csblob)) - if err := mw.GetLastError(); err != nil { - return nil, err - } ret := C.GoBytes(unsafe.Pointer(csblob), C.int(clen)) runtime.KeepAlive(mw) + if err := mw.GetLastError(); err != nil { + return ret, err + } return ret, nil }