From 7a7f1c46daee65980ff771dfe930f97b097e09e7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joan=20Sol=C3=A0?= <jsola@iri.upc.edu>
Date: Wed, 10 Jun 2020 14:30:06 +0200
Subject: [PATCH] Add missing state blocks filled with zeros

---
 src/problem/problem.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/problem/problem.cpp b/src/problem/problem.cpp
index 225e6f1ed..18b850f10 100644
--- a/src/problem/problem.cpp
+++ b/src/problem/problem.cpp
@@ -440,6 +440,7 @@ VectorComposite Problem::getState(const StateStructure& _structure) const
                     state.insert(pair_key_vec);
             }
         }
+
         // check for empty blocks and fill them with zeros
         for (const auto& ckey : frame_structure_)
         {
@@ -483,6 +484,15 @@ VectorComposite Problem::getState (const TimeStamp& _ts, const StateStructure& _
                 state.insert(pair_key_vec);
         }
     }
+
+    // check for empty blocks and fill them with zeros
+    for (const auto& ckey : frame_structure_)
+    {
+        const auto& key = string(1,ckey);
+        if (state.count(key) == 0)
+            state.emplace(key, stateZero(key).at(key));
+    }
+
     return state;
 }
 
-- 
GitLab