summaryrefslogtreecommitdiff
path: root/impl/EquationSystem.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'impl/EquationSystem.hpp')
-rw-r--r--impl/EquationSystem.hpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/impl/EquationSystem.hpp b/impl/EquationSystem.hpp
index 4c55bd7..2fd24bd 100644
--- a/impl/EquationSystem.hpp
+++ b/impl/EquationSystem.hpp
@@ -96,15 +96,12 @@ struct EquationSystem {
}
Variable<Domain>* varFromExpr(const Expression<Domain>& expr) const {
- if (_expr_to_var) { // we've indexed:
- auto* maxExpr = dynamic_cast<const MaxExpression<Domain>*>(&expr);
- if (maxExpr) {
- return (*_expr_to_var)[*maxExpr];
- } else {
- return NULL;
- }
+ assert(_expr_to_var); // make sure we've indexed
+ const MaxExpression<Domain>* maxExpr = expr.toMaxExpression();//dynamic_cast<const MaxExpression<Domain>*>(&expr);
+ if (maxExpr) {
+ return (*_expr_to_var)[*maxExpr];
} else {
- throw "Must index max expressions before attempting lookup";
+ return NULL;
}
}