From d268f6373f6007f934b4e185a82bae34a7c668e9 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 31 May 2010 22:15:34 -0400 Subject: [PATCH] Fixed crash when pushing an empty string on the include_stack. Turns out you can't just ignore some pushes. :) --- mojoshader_preprocessor.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mojoshader_preprocessor.c b/mojoshader_preprocessor.c index df038fb4..1757e8b2 100644 --- a/mojoshader_preprocessor.c +++ b/mojoshader_preprocessor.c @@ -604,9 +604,6 @@ static int push_source(Context *ctx, const char *fname, const char *source, 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 int push_source(Context *ctx, const char *fname, const char *source, static void pop_source(Context *ctx) { IncludeState *state = ctx->include_stack; + assert(state != NULL); // more pops than pushes! if (state == NULL) return;