[Impeller] null check device buffer in image encoding. (#161194)

Fixes https://github.com/flutter/flutter/issues/160652
This commit is contained in:
Jonah Williams 2025-01-14 16:34:53 -08:00 committed by GitHub
parent e0d7b588b6
commit b515f829af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -165,6 +165,12 @@ void ImageEncodingImpeller::ConvertDlImageToSkImage(
texture->GetTextureDescriptor().GetByteSizeOfBaseMipLevel();
auto buffer =
impeller_context->GetResourceAllocator()->CreateBuffer(buffer_desc);
if (!buffer) {
encode_task(fml::Status(fml::StatusCode::kUnimplemented,
"Failed to allocate destination buffer."));
return;
}
auto command_buffer = impeller_context->CreateCommandBuffer();
command_buffer->SetLabel("BlitTextureToBuffer Command Buffer");
auto pass = command_buffer->CreateBlitPass();