Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 68af8cc

Browse files
author
Jonah Williams
authored
[Impeller] add missing null check. (#51711)
surface can return null if we failed to allocate MSAA or depth/stencil textures.
1 parent dad4edb commit 68af8cc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

shell/gpu/gpu_surface_metal_impeller.mm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@
150150
auto surface = impeller::SurfaceMTL::MakeFromMetalLayerDrawable(renderer->GetContext(),
151151
drawable, clip_rect);
152152

153+
// The surface may be null if we failed to allocate the onscreen render target
154+
// due to running out of memory.
155+
if (!surface) {
156+
return false;
157+
}
158+
153159
if (clip_rect && clip_rect->IsEmpty()) {
154160
return surface->Present();
155161
}

0 commit comments

Comments
 (0)