From b11f9d5f59aa4df456e343844d7c784c8f759c66 Mon Sep 17 00:00:00 2001
From: Stephane Del Pino <stephane.delpino44@gmail.com>
Date: Mon, 1 Oct 2018 15:56:08 +0200
Subject: [PATCH] Allow empty array affectation to not build ItemValue

---
 src/mesh/ItemValue.hpp | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/mesh/ItemValue.hpp b/src/mesh/ItemValue.hpp
index 1b6e10e25..03f798fa2 100644
--- a/src/mesh/ItemValue.hpp
+++ b/src/mesh/ItemValue.hpp
@@ -82,19 +82,21 @@ class ItemValue
                    or not std::is_const<DataType2>()),
                   "Cannot assign  ItemValue of const to ItemValue of non-const");
 
-    if (not m_is_built) {
-      perr() << "Cannot assign array of values to a non-built ItemValue\n";
-      std::exit(1);
-    }
     if (m_values.size() != values.size()) {
       perr() << "Cannot assign an array of values of a different size\n";
       std::exit(1);
     }
 
-    m_values = values;
+    if (values.size() > 0) {
+      if (not m_is_built) {
+        perr() << "Cannot assign array of values to a non-built ItemValue\n";
+        std::exit(1);
+      }
 
-    return *this;
+      m_values = values;
+    }
 
+    return *this;
   }
 
   template <typename DataType2>
-- 
GitLab