From f1b7bcb34ccf28d917f6fa586191485287c6babf Mon Sep 17 00:00:00 2001
From: Olivier BICHLER <olivier.bichler@cea.fr>
Date: Sat, 12 Oct 2024 16:58:07 +0200
Subject: [PATCH] Fixed map::at() bug in DynamicAttribute::dict()

---
 include/aidge/utils/DynamicAttributes.hpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/aidge/utils/DynamicAttributes.hpp b/include/aidge/utils/DynamicAttributes.hpp
index 52056852b..1b55d7afb 100644
--- a/include/aidge/utils/DynamicAttributes.hpp
+++ b/include/aidge/utils/DynamicAttributes.hpp
@@ -166,7 +166,14 @@ public:
                 attributes[elt.first.c_str()] = future_std::any_cast<const DynamicAttributes&>(elt.second).dict();
             }
             else {
-                attributes[elt.first.c_str()] = mAnyUtils.at(elt.second.type())->cast(elt.second);
+                // At this point, not every attribute may be known to mAnyUtils
+                const auto anyUtilsIt = mAnyUtils.find(elt.second.type());
+                if (anyUtilsIt != mAnyUtils.end()) {
+                    attributes[elt.first.c_str()] = anyUtilsIt->second->cast(elt.second);
+                }
+                else {
+                    attributes[elt.first.c_str()] = "???";
+                }
             }
         }
         return attributes;
-- 
GitLab