From: alegrand Date: Tue, 16 Aug 2005 18:51:50 +0000 (+0000) Subject: Preparing surf_parser to be hijacked X-Git-Tag: v3.3~3708 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/981999f4f8431a115718b4bb55a8877539b9d89d?ds=sidebyside Preparing surf_parser to be hijacked git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@1649 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/surf/surf_parse.c b/src/surf/surf_parse.c index b8101062bd..1331cbac73 100644 --- a/src/surf/surf_parse.c +++ b/src/surf/surf_parse.c @@ -150,6 +150,10 @@ void ETag_argument(void) } void surf_parse_open(const char *file) { + if(!file) { + WARN0("I hope you know what you're doing... you just gave me a NULL pointer!"); + return; + } if(!surf_input_buffer_stack) surf_input_buffer_stack = xbt_dynar_new(sizeof(YY_BUFFER_STATE),NULL); if(!surf_file_to_parse_stack) @@ -168,8 +172,10 @@ void surf_parse_close(void) { if(surf_file_to_parse_stack) xbt_dynar_free(&surf_file_to_parse_stack); - surf_parse__delete_buffer(surf_input_buffer); - fclose(surf_file_to_parse); + if(surf_file_to_parse) { + surf_parse__delete_buffer(surf_input_buffer); + fclose(surf_file_to_parse); + } } int surf_parse(void)