From cf070c6bc79c7ebeada8431cbdd437b69b5b2370 Mon Sep 17 00:00:00 2001 From: Philip Rideout Date: Mon, 29 Mar 2021 10:20:39 -0700 Subject: [PATCH] RenderTarget: fix NPE when depth is not present. This fixes a recent regression that would occur when a RenderTarget does not have a depth attachment. --- filament/src/RenderTarget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filament/src/RenderTarget.cpp b/filament/src/RenderTarget.cpp index dad0c9e074..369a1e519d 100644 --- a/filament/src/RenderTarget.cpp +++ b/filament/src/RenderTarget.cpp @@ -109,7 +109,7 @@ FRenderTarget::HwHandle FRenderTarget::createHandle(FEngine& engine, const Build auto dtexture = depth.texture ? upcast(depth.texture)->getHwHandle() : TextureHandle(); const TargetBufferInfo dinfo = - upcast(depth.texture)->getTarget() == Texture::Sampler::SAMPLER_CUBEMAP ? + depth.texture && upcast(depth.texture)->getTarget() == Texture::Sampler::SAMPLER_CUBEMAP ? TargetBufferInfo(dtexture, depth.mipLevel, depth.face) : TargetBufferInfo(dtexture, depth.mipLevel, depth.layer);