shithub: cstory

Download patch

ref: f42a0530b04f9d8cd7204971dfd9b2d3a8183de3
parent: e90b90369272b66bd6e52c6c4049dc6b6e4cebad
author: Clownacy <Clownacy@users.noreply.github.com>
date: Thu Sep 10 11:59:44 EDT 2020

Handle the framebuffer failing to lock

Also needed by SDL2

--- a/src/Backends/Rendering/Software.cpp
+++ b/src/Backends/Rendering/Software.cpp
@@ -128,7 +128,7 @@
 
 ATTRIBUTE_HOT void RenderBackend_Blit(RenderBackend_Surface *source_surface, const RenderBackend_Rect *rect, RenderBackend_Surface *destination_surface, long x, long y, bool colour_key)
 {
-	if (source_surface == NULL || destination_surface == NULL)
+	if (source_surface == NULL || source_surface->pixels == NULL || destination_surface == NULL || destination_surface->pixels == NULL)
 		return;
 
 	RenderBackend_Rect rect_clamped;
@@ -214,7 +214,7 @@
 
 ATTRIBUTE_HOT void RenderBackend_ColourFill(RenderBackend_Surface *surface, const RenderBackend_Rect *rect, unsigned char red, unsigned char green, unsigned char blue)
 {
-	if (surface == NULL)
+	if (surface == NULL || surface->pixels == NULL)
 		return;
 
 	RenderBackend_Rect rect_clamped;