!47671 【告警】判空保护

Merge pull request !47671 from 吴寅潇/reduceWarning
This commit is contained in:
openharmony_ci 2024-11-05 07:24:17 +00:00 committed by Gitee
commit 10480734f5
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -314,7 +314,7 @@ void LayeredDrawableDescriptor::InitLayeredParam(std::pair<std::unique_ptr<uint8
}
auto background = Media::ImageSource::CreateImageSource(backgroundInfo.first.get(), backgroundInfo.second, opts,
errorCode);
if (errorCode == 0) {
if (errorCode == 0 && background) {
Media::DecodeOptions decodeOpts;
decodeOpts.desiredPixelFormat = Media::PixelFormat::BGRA_8888;
auto pixelMapPtr = background->CreatePixelMap(decodeOpts, errorCode);