From c09cc18290e4c9a15acfab29f7d92034f467afff Mon Sep 17 00:00:00 2001 From: Matthias Volk Date: Fri, 17 Apr 2026 18:06:13 +0200 Subject: [PATCH] Fixed warning on dangling reference to tmp object. Thanks @plindnercs --- src/storm/storage/umb/import/SparseModelFromUmb.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/storm/storage/umb/import/SparseModelFromUmb.cpp b/src/storm/storage/umb/import/SparseModelFromUmb.cpp index 1b0fff4a5..4a0196c5c 100644 --- a/src/storm/storage/umb/import/SparseModelFromUmb.cpp +++ b/src/storm/storage/umb/import/SparseModelFromUmb.cpp @@ -93,7 +93,8 @@ storm::models::sparse::StateLabeling constructStateLabeling(storm::umb::UmbModel stateLabelling.addLabel("init", storm::storage::BitVector(numStates, false)); // default to all states not being initial } if (umbModel.index.aps().has_value()) { - for (auto const& [apName, apIndex] : umbModel.index.aps().value()) { + auto aps = umbModel.index.aps(); + for (auto const& [apName, apIndex] : aps.value()) { STORM_LOG_THROW(umbModel.aps().has_value() && umbModel.aps()->contains(apName), storm::exceptions::WrongFormatException, "Atomic proposition '" << apName << "' mentioned in index but no files were found."); STORM_LOG_THROW(isBooleanType(apIndex.type.type), storm::exceptions::WrongFormatException, @@ -159,7 +160,8 @@ auto constructRewardModels(storm::umb::UmbModel const& umbModel) { using RewardModel = storm::models::sparse::StandardRewardModel; std::unordered_map rewardModels; if (umbModel.index.rewards().has_value()) { - for (auto const& [rewName, rewIndex] : umbModel.index.rewards().value()) { + auto rewards = umbModel.index.rewards(); + for (auto const& [rewName, rewIndex] : rewards.value()) { STORM_LOG_THROW(umbModel.rewards().has_value() && umbModel.rewards()->contains(rewName), storm::exceptions::WrongFormatException, "Reward " << rewName << "' mentioned in index but no files were found."); auto const& rew = umbModel.rewards()->at(rewName);