diff --git a/src/storm/storage/expressions/Variable.cpp b/src/storm/storage/expressions/Variable.cpp index 0cccde8e0..5cd1716ca 100644 --- a/src/storm/storage/expressions/Variable.cpp +++ b/src/storm/storage/expressions/Variable.cpp @@ -3,11 +3,11 @@ namespace storm { namespace expressions { - Variable::Variable() { + Variable::Variable() : manager(nullptr) { // Intentionally left empty. } - Variable::Variable(std::shared_ptr const& manager, uint_fast64_t index) : manager(manager), index(index) { + Variable::Variable(std::shared_ptr const& manager, uint_fast64_t index) : manager(manager.get()), index(index) { // Intentionally left empty. } @@ -52,7 +52,8 @@ namespace storm { } ExpressionManager const& Variable::getManager() const { - return *manager.lock(); + STORM_LOG_ASSERT(manager != nullptr, "The variable does not have a manager."); + return *manager; } bool Variable::hasBooleanType() const { diff --git a/src/storm/storage/expressions/Variable.h b/src/storm/storage/expressions/Variable.h index 3ecea02c0..3fe77467c 100644 --- a/src/storm/storage/expressions/Variable.h +++ b/src/storm/storage/expressions/Variable.h @@ -138,7 +138,7 @@ namespace storm { private: // The manager that is responsible for this variable. - std::weak_ptr manager; + ExpressionManager const* manager; // The index of the variable. uint_fast64_t index;