From 981999f4f8431a115718b4bb55a8877539b9d89d Mon Sep 17 00:00:00 2001 From: alegrand Date: Tue, 16 Aug 2005 18:51:50 +0000 Subject: [PATCH] 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 --- src/surf/surf_parse.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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) -- 2.20.1