From d8c9bbc353e8342885b38d42adc97f0d7125579c Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan@dynare.org>
Date: Fri, 22 Feb 2019 11:52:07 +0100
Subject: [PATCH] ensure that h1/h0_param_indices are created regardless of
 whether there are parameters or not

---
 src/DynamicModel.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc
index faedb6a6..98c0f257 100644
--- a/src/DynamicModel.cc
+++ b/src/DynamicModel.cc
@@ -3718,6 +3718,9 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
             output << get<3>(it) << " ";
           output << "];" << endl;
         }
+      // Create empty h0 and h1 substructures that will be overwritten later if not empty
+      output << modstruct << "pac." << substruct << "h0_param_indices = [];" << endl
+             << modstruct << "pac." << substruct << "h1_param_indices = [];" << endl;
     }
 
   for (auto & it : pac_h0_indices)
-- 
GitLab