shithub: choc

Download patch

ref: 0bdb203dc87a45b85f1fbe5651fc40e5b286cb02
parent: 12b7676e7deb1e290be5128137014523227750a8
author: Fabian Greffrath <[email protected]>
date: Tue Mar 17 04:05:50 EDT 2015

Fix possible crash with software renderer

https://github.com/bradharding/doomretro/commit/7dbbd2ccd293f3a2a1df7a03971f8dd24d0d2a5d

--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1107,9 +1107,11 @@
 
     // Update the texture with the content of the 32-bit RGBA buffer
 
-    SDL_LockTexture(texture, NULL, &pixels, &pitch);
-    memcpy(pixels, rgbabuffer->pixels, SCREENHEIGHT*pitch);
-    SDL_UnlockTexture(texture);
+    if (!SDL_LockTexture(texture, NULL, &pixels, &pitch))
+    {
+	memcpy(pixels, rgbabuffer->pixels, SCREENHEIGHT*pitch);
+	SDL_UnlockTexture(texture);
+    }
 
     // Render the texture into the window