From 7a3086a3df6a2e1b475bdb7b8dc174baf0c0731d Mon Sep 17 00:00:00 2001 From: Toni Spets Date: Mon, 8 Nov 2010 17:34:33 +0200 Subject: [PATCH] Fix crash race condition in OpenGL renderer --- render_opengl.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/render_opengl.c b/render_opengl.c index 4053a9e..3b4428a 100644 --- a/render_opengl.c +++ b/render_opengl.c @@ -145,11 +145,14 @@ DWORD WINAPI render_opengl_main(IDirectDrawSurfaceImpl *surface) } /* convert ddraw surface to opengl texture */ - for(i=0; iheight; i++) + if(surface->palette) { - for(j=0; jwidth; j++) + for(i=0; iheight; i++) { - tex[i*surface->width+j] = surface->palette->data_bgr[((unsigned char *)surface->surface)[i*surface->lPitch + j*surface->lXPitch]]; + for(j=0; jwidth; j++) + { + tex[i*surface->width+j] = surface->palette->data_bgr[((unsigned char *)surface->surface)[i*surface->lPitch + j*surface->lXPitch]]; + } } }