changeset 5209:7d64745f1363

Fixed crash when binary shaders are not available.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 06 Feb 2011 08:46:48 -0800
parents af7caea67886
children 443a850284a1
files src/render/opengles2/SDL_render_gles2.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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)