[Impeller] add missing null check. (flutter/engine#51711)
surface can return null if we failed to allocate MSAA or depth/stencil textures.
This commit is contained in:
@@ -150,6 +150,12 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceMetalImpeller::AcquireFrameFromCAMetalLa
|
||||
auto surface = impeller::SurfaceMTL::MakeFromMetalLayerDrawable(renderer->GetContext(),
|
||||
drawable, clip_rect);
|
||||
|
||||
// The surface may be null if we failed to allocate the onscreen render target
|
||||
// due to running out of memory.
|
||||
if (!surface) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (clip_rect && clip_rect->IsEmpty()) {
|
||||
return surface->Present();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user