From e8f12e0fe3d9332826b32fd44d4dae79579b1d31 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Fri, 14 Apr 2023 14:21:47 +0200 Subject: [PATCH] More defensive programing style --- src/mc/api/State.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mc/api/State.cpp b/src/mc/api/State.cpp index bccd340ac8..38b0a35847 100644 --- a/src/mc/api/State.cpp +++ b/src/mc/api/State.cpp @@ -22,8 +22,10 @@ State::State(RemoteApp& remote_app) : num_(++expended_states_) XBT_VERB("Creating a guide for the state"); if (_sg_mc_strategy == "none") strategy_ = std::make_shared(); - if (_sg_mc_strategy == "nb_wait") + else if (_sg_mc_strategy == "nb_wait") strategy_ = std::make_shared(); + else + THROW_IMPOSSIBLE; recipe_ = std::list(); @@ -42,8 +44,10 @@ State::State(RemoteApp& remote_app, std::shared_ptr parent_state) { if (_sg_mc_strategy == "none") strategy_ = std::make_shared(); - if (_sg_mc_strategy == "nb_wait") + else if (_sg_mc_strategy == "nb_wait") strategy_ = std::make_shared(); + else + THROW_IMPOSSIBLE; *strategy_ = *(parent_state->strategy_); recipe_ = std::list(parent_state_->get_recipe()); -- 2.20.1