From ebde0c72b64b9c39bd1ef911f5d588afb188857c Mon Sep 17 00:00:00 2001
From: Norbert Grunwald <Norbert.Grunwald@ufz.de>
Date: Wed, 16 Dec 2020 11:12:00 +0100
Subject: [PATCH] <MPL> medium throws an error if a property is not defined in
 the input file

---
 MaterialLib/MPL/Medium.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/MaterialLib/MPL/Medium.cpp b/MaterialLib/MPL/Medium.cpp
index 094bb66d2b4..0d9abb04a46 100644
--- a/MaterialLib/MPL/Medium.cpp
+++ b/MaterialLib/MPL/Medium.cpp
@@ -44,6 +44,12 @@ Phase const& Medium::phase(std::string const& name) const
 
 Property const& Medium::property(PropertyType const& p) const
 {
+    Property const* const property = properties_[p].get();
+    if (property == nullptr)
+    {
+        OGS_FATAL("Trying to access undefined property '{:s}' of {:s}",
+                  property_enum_to_string[p], description());
+    }
     return *properties_[p];
 }
 
-- 
GitLab