From 939f0b7256e9d62779dc223629c0a5f6824580ea Mon Sep 17 00:00:00 2001 From: v4hn Date: Tue, 18 Aug 2020 21:14:29 +0200 Subject: [PATCH] setCostTermShort(nullptr) must not set a valid function --- core/src/stage.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/stage.cpp b/core/src/stage.cpp index b4e6e051..a0c75b69 100644 --- a/core/src/stage.cpp +++ b/core/src/stage.cpp @@ -356,7 +356,10 @@ void Stage::setCostTerm(const CostTerm& term) { } void Stage::setCostTerm(const CostTermShort& term) { - setCostTerm([=](auto&& solution, auto&&) { return term(solution); }); + if (term) + setCostTerm([=](auto&& solution, auto&&) { return term(solution); }); + else + pimpl()->cost_term_ = nullptr; } const ordered& Stage::solutions() const {