mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[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:
parent
d93f7f3275
commit
b18dfd5fa7
@ -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();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user