Skip to content

Commit

Permalink
Always generate FNAM chunk when functions are present
Browse files Browse the repository at this point in the history
  • Loading branch information
positively-charged committed Jan 13, 2017
1 parent 16fa635 commit c7191f5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/codegen/chunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,14 @@ int c_total_param_size( struct func* func ) {
return size;
}

// If a library has only private functions and the FNAM chunk is missing, the
// game engine will crash when attempting to execute the `acsprofile` command.
// Always output the FNAM chunk if the FUNC chunk is present, even if the FNAM
// chunk will end up being empty.
void do_fnam( struct codegen* codegen ) {
if ( list_size( &codegen->funcs ) == 0 ) {
return;
}
int count = 0;
int size = 0;
list_iter_t i;
Expand All @@ -330,9 +337,6 @@ void do_fnam( struct codegen* codegen ) {
}
list_next( &i );
}
if ( count == 0 ) {
return;
}
int offset =
sizeof( int ) +
sizeof( int ) * count;
Expand Down

0 comments on commit c7191f5

Please sign in to comment.