From 78a3b2a6a7af2af492d16c6295dbf8211fe33aff Mon Sep 17 00:00:00 2001 From: lukpo Date: Mon, 19 Jul 2021 16:53:58 +0200 Subject: [PATCH] Nullpointer check for dirOverride --- src/storm/solver/Multiplier.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/storm/solver/Multiplier.cpp b/src/storm/solver/Multiplier.cpp index f36a6c87c..0cc159e75 100644 --- a/src/storm/solver/Multiplier.cpp +++ b/src/storm/solver/Multiplier.cpp @@ -97,13 +97,23 @@ namespace storm { auto choice_it = choiceValues.begin(); for(uint state = 0; state < rowGroupIndices.size() - 1; state++) { uint rowGroupSize = rowGroupIndices[state + 1] - rowGroupIndices[state]; - if((dir == storm::OptimizationDirection::Minimize && !dirOverride->get(state)) || (dir == storm::OptimizationDirection::Maximize && dirOverride->get(state))) { - result.at(state) = *std::min_element(choice_it, choice_it + rowGroupSize); - choice_it += rowGroupSize; - } - else { - result.at(state) = *std::max_element(choice_it, choice_it + rowGroupSize); - choice_it += rowGroupSize; + if(dirOverride != nullptr) { + if((dir == storm::OptimizationDirection::Minimize && !dirOverride->get(state)) || (dir == storm::OptimizationDirection::Maximize && dirOverride->get(state))) { + result.at(state) = *std::min_element(choice_it, choice_it + rowGroupSize); + choice_it += rowGroupSize; + } + else { + result.at(state) = *std::max_element(choice_it, choice_it + rowGroupSize); + choice_it += rowGroupSize; + } + } else { + if(dir == storm::OptimizationDirection::Minimize) { + result.at(state) = *std::min_element(choice_it, choice_it + rowGroupSize); + choice_it += rowGroupSize; + } else { + result.at(state) = *std::max_element(choice_it, choice_it + rowGroupSize); + choice_it += rowGroupSize; + } } } }