From: David Reiss Date: Tue, 10 Jun 2008 22:56:26 +0000 (+0000) Subject: Print an error instead of segfaulting with a bad compiler command line. X-Git-Tag: 0.2.0~774 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=5245f40b3e13c65ef6537a8121b74128a9e61ed4;p=common%2Fthrift.git Print an error instead of segfaulting with a bad compiler command line. git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666370 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/compiler/cpp/src/main.cc b/compiler/cpp/src/main.cc index 9f9c2608..f2f3a9b1 100644 --- a/compiler/cpp/src/main.cc +++ b/compiler/cpp/src/main.cc @@ -1112,6 +1112,10 @@ int main(int argc, char** argv) { // Real-pathify it char rp[PATH_MAX]; + if (argv[i] == NULL) { + fprintf(stderr, "!!! Missing file name\n"); + usage(); + } if (saferealpath(argv[i], rp) == NULL) { failure("Could not open input file with realpath: %s", argv[i]); }