From 1918a56a70371470546b4b0c7f034807338a9eb8 Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan@dynare.org>
Date: Wed, 22 Aug 2018 12:45:07 +0200
Subject: [PATCH] fix bug in 539fddc9f68c751c3f83559403cc7ef5e7e04e76

---
 src/ModFile.cc  | 1 +
 src/SubModel.cc | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/ModFile.cc b/src/ModFile.cc
index 788801cd..7aafd300 100644
--- a/src/ModFile.cc
+++ b/src/ModFile.cc
@@ -868,6 +868,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
 
   symbol_table.writeOutput(mOutputFile);
 
+  var_model_table.writeOutput(mOutputFile);
   trend_component_model_table.writeOutput(mOutputFile);
 
   // Initialize M_.Sigma_e, M_.Correlation_matrix, M_.H, and M_.Correlation_matrix_ME
diff --git a/src/SubModel.cc b/src/SubModel.cc
index 731993e2..679a12c3 100644
--- a/src/SubModel.cc
+++ b/src/SubModel.cc
@@ -334,7 +334,7 @@ VarModelTable::writeOutput(ostream &output) const
   for (const auto &name : names)
     {
       output << "M_.var." << name << ".model_name = '" << name << "';" << endl;
-      if (!symbol_list_and_order.empty())
+      if (!symbol_list_and_order.at(name).first.empty())
         {
           symbol_list_and_order.at(name).first.writeOutput("M_.var." + name + ".var_list_", output);
           output  << "M_.var." << name << ".order = "
-- 
GitLab