summaryrefslogtreecommitdiff
path: root/hscript/script.cc
diff options
context:
space:
mode:
Diffstat (limited to 'hscript/script.cc')
-rw-r--r--hscript/script.cc26
1 files changed, 13 insertions, 13 deletions
diff --git a/hscript/script.cc b/hscript/script.cc
index 487ea9b..038c9c1 100644
--- a/hscript/script.cc
+++ b/hscript/script.cc
@@ -114,32 +114,32 @@ const Script *Script::load(std::istream &sstream, ScriptOptions opts) {
}
}
- output_message("parser", "0", "installfile",
- std::to_string(errors) + " error(s), " +
- std::to_string(warnings) + " warning(s).",
- "", opts.test(Pretty));
-
- if(errors > 0) {
- delete the_script;
- return nullptr;
- }
-
if(sstream.fail() && !sstream.eof()) {
output_error("installfile:" + std::to_string(lineno + 1),
"line exceeds maximum length",
"Maximum length for line is " + std::to_string(LINE_MAX),
(opts.test(Pretty)));
- delete the_script;
- return nullptr;
+ errors++;
}
if(sstream.bad() && !sstream.eof()) {
output_error("installfile:" + std::to_string(lineno),
"I/O error reading installfile", "",
(opts.test(Pretty)));
+ errors++;
}
- return the_script;
+ output_message("parser", "0", "installfile",
+ std::to_string(errors) + " error(s), " +
+ std::to_string(warnings) + " warning(s).",
+ "", opts.test(Pretty));
+
+ if(errors > 0) {
+ delete the_script;
+ return nullptr;
+ } else {
+ return the_script;
+ }
}
bool Script::validate() const {