aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Source/Modules/main.cxx9
1 files changed, 4 insertions, 5 deletions
diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx
index c6bd148e2..294455772 100644
--- a/Source/Modules/main.cxx
+++ b/Source/Modules/main.cxx
@@ -1376,13 +1376,12 @@ int SWIG_main(int argc, char *argv[], const TargetLanguageModule *tlm) {
while (freeze) {
}
- if ((werror) && (Swig_warn_count())) {
- return Swig_warn_count();
- }
-
delete lang;
- return Swig_error_count();
+ int error_count = werror ? Swig_warn_count() : 0;
+ error_count += Swig_error_count();
+
+ return error_count;
}
/* -----------------------------------------------------------------------------