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]]; + } } }