Skip to content

Commit

Permalink
Handle NULL file names.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Feb 10, 2009
1 parent fdcb89a commit a00d4b8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions mojoshader_preprocessor.c
Expand Up @@ -198,11 +198,14 @@ static int push_source(Context *ctx, const char *fname, const char *source,
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;
Expand Down

0 comments on commit a00d4b8

Please sign in to comment.