mojoshader_preprocessor.c
branchcalculator-experiment
changeset 813 a8ec84003cd2
parent 798 5dd67cc04cf9
child 841 05fa7ce0a202
--- a/mojoshader_preprocessor.c	Mon Feb 08 03:04:29 2010 -0500
+++ b/mojoshader_preprocessor.c	Mon Feb 08 03:30:48 2010 -0500
@@ -656,8 +656,6 @@
     // the preprocessor is internal-only, so we verify all these are != NULL.
     assert(m != NULL);
     assert(f != NULL);
-    assert(open_callback != NULL);
-    assert(close_callback != NULL);
 
     Context *ctx = (Context *) m(sizeof (Context), d);
     if (ctx == NULL)
@@ -837,6 +835,12 @@
 
     const char *newdata = NULL;
     unsigned int newbytes = 0;
+    if ((ctx->open_callback == NULL) || (ctx->close_callback == NULL))
+    {
+        fail(ctx, "Saw #include, but no include callbacks defined");
+        return;
+    } // if
+
     if (!ctx->open_callback(incltype, filename, state->source_base,
                             &newdata, &newbytes, ctx->malloc,
                             ctx->free, ctx->malloc_data))