From c0cf0dbe806dd18a0822801703a3e9a5c3f15fd3 Mon Sep 17 00:00:00 2001 From: jiangminsen Date: Wed, 9 Oct 2024 16:51:02 +0800 Subject: [PATCH] =?UTF-8?q?cherry=20pick=20878a004=20from=20https://gitee.?= =?UTF-8?q?com/jiangminsen/bundlemanager=5Fdistributed=5Fbundle=5Fframewor?= =?UTF-8?q?k/pulls/79=20=E5=AE=89=E5=85=A8=E5=91=8A=E8=AD=A6=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: jiangminsen --- services/dbms/src/image_compress.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/dbms/src/image_compress.cpp b/services/dbms/src/image_compress.cpp index 894bc16..6365e81 100644 --- a/services/dbms/src/image_compress.cpp +++ b/services/dbms/src/image_compress.cpp @@ -151,12 +151,16 @@ bool ImageCompress::CompressImageByContent(const std::unique_ptr &fil Media::SourceOptions options; std::unique_ptr imageSourcePtr = Media::ImageSource::CreateImageSource(fileData.get(), fileSize, options, errorCode); + if (imageSourcePtr == nullptr) { + APP_LOGE("imageSourcePtr nullptr"); + return false; + } // do compress Media::DecodeOptions decodeOptions; uint32_t pixMapError = 0; std::unique_ptr pixMap = imageSourcePtr->CreatePixelMap(decodeOptions, pixMapError); if (pixMap == nullptr || pixMapError != Media::SUCCESS) { - APP_LOGE("CreatePixelMap failed!"); + APP_LOGE("CreatePixelMap failed"); return false; } double ratio = CalculateRatio(fileSize, imageType); -- Gitee