setCostTermShort(nullptr) must not set a valid function

This commit is contained in:
v4hn 2020-08-18 21:14:29 +02:00
parent a0975e3afc
commit 939f0b7256

View File

@ -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<SolutionBaseConstPtr>& Stage::solutions() const {