shithub: cstory

Download patch

ref: a7f2ec6a5e85d5a11e4c1a68409710ce5f07616f
parent: a8d0595bcd1da3e2faad92e378d8366b5a93ae5e
author: Clownacy <Clownacy@users.noreply.github.com>
date: Thu Apr 23 15:53:33 EDT 2020

Safely-handle LockSurface failing

Fixes crash on Wii U at 1280x720 (LockSurface fails there because
CreateSurface fails - maybe it's running out of memory again)

--- a/src/Draw.cpp
+++ b/src/Draw.cpp
@@ -154,6 +154,9 @@
 	unsigned int pitch;
 	unsigned char *pixels = RenderBackend_LockSurface(surf[surf_no], &pitch, width * magnification, height * magnification);
 
+	if (pixels == NULL)
+		return FALSE;
+
 	if (magnification == 1)
 	{
 		// Just copy the pixels the way they are