NoError was returning on DoParse method when file was empty (#4208)
authorLouis-Paul CORDIER <lp.cordier@dynamixyz.com>
Fri, 10 Mar 2017 16:50:44 +0000 (17:50 +0100)
committerWouter van Oortmerssen <aardappel@gmail.com>
Fri, 10 Mar 2017 16:50:44 +0000 (08:50 -0800)
* NoError was returning on DoParse method when file was empty.

* change NoError message in DoParse.

src/idl_parser.cpp

index 7adfcca..0d689da 100644 (file)
@@ -1874,6 +1874,10 @@ CheckedError Parser::DoParse(const char *source, const char **include_paths,
   namespaces_.push_back(new Namespace());
   ECHECK(SkipByteOrderMark());
   NEXT();
+
+  if (Is(kTokenEof))
+      return Error("input file is empty");
+
   // Includes must come before type declarations:
   for (;;) {
     // Parse pre-include proto statements if any: