Fixed crash when binary shaders are not available.
authorSam Lantinga <slouken@libsdl.org>
Sun, 06 Feb 2011 08:46:48 -0800
changeset 5206 7d64745f1363
parent 5205 af7caea67886
child 5207 443a850284a1
Fixed crash when binary shaders are not available.
src/render/opengles2/SDL_render_gles2.c
--- a/src/render/opengles2/SDL_render_gles2.c	Sun Feb 06 02:41:32 2011 -0800
+++ b/src/render/opengles2/SDL_render_gles2.c	Sun Feb 06 08:46:48 2011 -0800
@@ -558,16 +558,17 @@
     }
     
     /* Find a matching shader instance that's supported on this hardware */
-    for (i = 0; i < shader->instance_count; ++i)
+    for (i = 0; i < shader->instance_count && !instance; ++i)
     {
-        for (j = 0; j < rdata->shader_format_count; ++j)
+        for (j = 0; j < rdata->shader_format_count && !instance; ++j)
         {
             if (!shader->instances)
                 continue;
+            if (!shader->instances[i])
+                continue;
             if (shader->instances[i]->format != rdata->shader_formats[j])
                 continue;
             instance = shader->instances[i];
-            break;
         }
     }
     if (!instance)