Handle NULL file names.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 10 Feb 2009 17:30:52 -0500
changeset 560 225d579ae929
parent 559 d34ac77da171
child 561 0d2535cc5ac3
Handle NULL file names.
mojoshader_preprocessor.c
--- a/mojoshader_preprocessor.c	Tue Feb 10 17:29:36 2009 -0500
+++ b/mojoshader_preprocessor.c	Tue Feb 10 17:30:52 2009 -0500
@@ -198,11 +198,14 @@
         return 0;
     memset(state, '\0', sizeof (IncludeState));
 
-    state->filename = StrDup(ctx, fname);
-    if (state->filename == NULL)
+    if (fname != NULL)
     {
-        Free(ctx, state);
-        return 0;
+        state->filename = StrDup(ctx, fname);
+        if (state->filename == NULL)
+        {
+            Free(ctx, state);
+            return 0;
+        } // if
     } // if
 
     state->included = included;