Will refuse pointer update with empty pointer

This commit is contained in:
Joakim Hove
2021-02-01 12:26:41 +01:00
parent 1032e16947
commit 1893daec8b

View File

@@ -149,7 +149,11 @@ namespace Opm {
}
void update(const K& key, const map_member<K,T>& other) {
this->m_data[key] = other.get_ptr(key);
auto other_ptr = other.get_ptr(key);
if (other_ptr)
this->m_data[key] = other.get_ptr(key);
else
throw std::logic_error(std::string{"Tried to update member: "} + std::to_string(key) + std::string{"with uninitialized object"});
}
const T& operator()(const K& key) const {