From 3b7b77da3af4642f9162aa47e0fff0a2ebfe784e Mon Sep 17 00:00:00 2001 From: "r.kuznetsov" Date: Mon, 17 Dec 2018 10:59:49 +0300 Subject: [PATCH] [Metal] Fixed crash on entering background --- drape/metal/metal_base_context.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drape/metal/metal_base_context.mm b/drape/metal/metal_base_context.mm index 52f225d48b..080e1c50b7 100644 --- a/drape/metal/metal_base_context.mm +++ b/drape/metal/metal_base_context.mm @@ -310,7 +310,9 @@ id MetalBaseContext::GetPipelineState(ref_ptr colorTexture = m_renderPassDescriptor.colorAttachments[0].texture; - CHECK(colorTexture != nil, ()); + // It can be nil in the case when Metal drawable is absent (e.g. finish rendering in background). + if (colorTexture == nil) + return nil; id depthTexture = m_renderPassDescriptor.depthAttachment.texture; MTLPixelFormat depthStencilFormat = (depthTexture != nil) ? depthTexture.pixelFormat : MTLPixelFormatInvalid;