Fixed crash when pushing an empty string on the include_stack.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 31 May 2010 22:15:34 -0400
changeset 913 483458775ec5
parent 912 bc2233202291
child 915 55b583afec46
Fixed crash when pushing an empty string on the include_stack. Turns out you can't just ignore some pushes. :)
mojoshader_preprocessor.c
--- a/mojoshader_preprocessor.c	Mon May 31 22:05:25 2010 -0400
+++ b/mojoshader_preprocessor.c	Mon May 31 22:15:34 2010 -0400
@@ -604,9 +604,6 @@
                        unsigned int srclen, unsigned int linenum,
                        MOJOSHADER_includeClose close_callback)
 {
-    if (srclen == 0)
-        return 1;  // nothing to do: just pretend you did it.
-
     IncludeState *state = get_include(ctx);
     if (state == NULL)
         return 0;
@@ -644,6 +641,7 @@
 static void pop_source(Context *ctx)
 {
     IncludeState *state = ctx->include_stack;
+    assert(state != NULL);  // more pops than pushes!
     if (state == NULL)
         return;