From 3f7676a740dd4c684514005cea831d30f4146426 Mon Sep 17 00:00:00 2001 From: Alex Lin Date: Wed, 27 Apr 2016 11:24:03 -0500 Subject: [PATCH] Invoking trick-ICG without any arguments results in a Segmentation fault ICG dies on a strdup if the the input file is empty. Added a check for an empty input file name. We exit with an error message if there is no input file given. refs #229 --- trick_source/codegen/Interface_Code_Gen/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/trick_source/codegen/Interface_Code_Gen/main.cpp b/trick_source/codegen/Interface_Code_Gen/main.cpp index 9c8bf1a5..e663d475 100644 --- a/trick_source/codegen/Interface_Code_Gen/main.cpp +++ b/trick_source/codegen/Interface_Code_Gen/main.cpp @@ -85,6 +85,11 @@ int main( int argc , char * argv[] ) { return 0 ; } + if ( input_file_names.empty() ) { + std::cerr << "No header file specified" << std::endl ; + return 1 ; + } + #if (__clang_major__ == 3) && (__clang_minor__ >= 3) ci.createDiagnostics(); #else