From e9ca966af71a1566cba7d7a279381f9eee81524f Mon Sep 17 00:00:00 2001 From: Tracy Ward Date: Fri, 4 Oct 2019 09:00:24 -0400 Subject: [PATCH] Allow CreateScreenshot to return nullptr RageDisplay_D3D::CreateScreenshot will be returning nullptr until I get around to re-implementing it without using d3dx, which is another thing that did not make the move into the Windows SDK. (backport from master) --- src/RageDisplay.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/RageDisplay.cpp b/src/RageDisplay.cpp index 4aeebd4ab9..68e1c0558f 100644 --- a/src/RageDisplay.cpp +++ b/src/RageDisplay.cpp @@ -766,6 +766,13 @@ bool RageDisplay::SaveScreenshot( RString sPath, GraphicsFileFormat format ) RageTimer timer; RageSurface *surface = this->CreateScreenshot(); // LOG->Trace( "CreateScreenshot took %f seconds", timer.GetDeltaTime() ); + + if (nullptr == surface) + { + LOG->Trace("CreateScreenshot failed to return a surface"); + return false; + } + /* Unless we're in lossless, resize the image to 640x480. If we're saving lossy, * there's no sense in saving 1280x960 screenshots, and we don't want to output * screenshots in a strange (non-1) sample aspect ratio. */