Skip to content

Commit b515f82

Browse files
author
Jonah Williams
authored
[Impeller] null check device buffer in image encoding. (#161194)
Fixes flutter/flutter#160652
1 parent e0d7b58 commit b515f82

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

engine/src/flutter/lib/ui/painting/image_encoding_impeller.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ void ImageEncodingImpeller::ConvertDlImageToSkImage(
165165
texture->GetTextureDescriptor().GetByteSizeOfBaseMipLevel();
166166
auto buffer =
167167
impeller_context->GetResourceAllocator()->CreateBuffer(buffer_desc);
168+
if (!buffer) {
169+
encode_task(fml::Status(fml::StatusCode::kUnimplemented,
170+
"Failed to allocate destination buffer."));
171+
return;
172+
}
173+
168174
auto command_buffer = impeller_context->CreateCommandBuffer();
169175
command_buffer->SetLabel("BlitTextureToBuffer Command Buffer");
170176
auto pass = command_buffer->CreateBlitPass();

0 commit comments

Comments
 (0)