Print an error instead of segfaulting with a bad compiler command line.
authorDavid Reiss <dreiss@apache.org>
Tue, 10 Jun 2008 22:56:26 +0000 (22:56 +0000)
committerDavid Reiss <dreiss@apache.org>
Tue, 10 Jun 2008 22:56:26 +0000 (22:56 +0000)
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666370 13f79535-47bb-0310-9956-ffa450edef68

compiler/cpp/src/main.cc

index 9f9c260..f2f3a9b 100644 (file)
@@ -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]);
   }