Anonymous
public text v1 · immutablediff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index f1217d9..b0005be 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -49,6 +49,8 @@ static void surface_bind_and_dirtify(IWineD3DSurfaceImpl *This) {
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture);
active_texture -= GL_TEXTURE0_ARB;
+ if (active_texture >= GL_MAX_TEXTURE_COORDS)
+ active_texture = 0; /* sanity checking */
} else {
active_texture = 0;
}