From 172a120c6d993fc425ef0065898ba830780d73e2 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Wed, 1 Jun 2022 17:58:06 -0700 Subject: [PATCH] Check for a deleted snapshot delegate in ConvertImageToRaster (#33764) --- lib/ui/painting/image_encoding.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/ui/painting/image_encoding.cc b/lib/ui/painting/image_encoding.cc index af9e5fe257afa..c8df75ebb68a8 100644 --- a/lib/ui/painting/image_encoding.cc +++ b/lib/ui/painting/image_encoding.cc @@ -104,6 +104,14 @@ void ConvertImageToRaster( raster_task_runner->PostTask([image, encode_task = std::move(encode_task), resource_context, snapshot_delegate, io_task_runner, is_gpu_disabled_sync_switch]() { + if (!snapshot_delegate) { + io_task_runner->PostTask( + [encode_task = std::move(encode_task)]() mutable { + encode_task(nullptr); + }); + return; + } + sk_sp raster_image = snapshot_delegate->ConvertToRasterImage(image);