From fde74d471013445cb7981219a7b7e9c2a8346129 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 2 Dec 2019 14:08:46 +0000 Subject: [PATCH] Handle thumbnails of 0 width or height without crashing --- renderdoc/core/core.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/renderdoc/core/core.cpp b/renderdoc/core/core.cpp index f52565bff..3e456b409 100644 --- a/renderdoc/core/core.cpp +++ b/renderdoc/core/core.cpp @@ -966,6 +966,12 @@ bool RenderDoc::ShouldTriggerCapture(uint32_t frameNumber) void RenderDoc::ResamplePixels(const FramePixels &in, RDCThumb &out) { + if(in.width == 0 || in.height == 0) + { + out = RDCThumb(); + return; + } + // code below assumes pitch_requirement is a power of 2 number RDCASSERT((in.pitch_requirement & (in.pitch_requirement - 1)) == 0); @@ -1076,6 +1082,12 @@ void RenderDoc::ResamplePixels(const FramePixels &in, RDCThumb &out) } void RenderDoc::EncodePixelsPNG(const RDCThumb &in, RDCThumb &out) { + if(in.width == 0 || in.height == 0) + { + out = RDCThumb(); + return; + } + struct WriteCallbackData { std::vector buffer;