From 1906ccf036d08b345b4d9204f72e6d6a45ccd435 Mon Sep 17 00:00:00 2001 From: Andrey Davydov Date: Thu, 5 Oct 2023 07:50:31 +0200 Subject: [PATCH] it doesn't make sense to return empty partition, 'out_of_range' exception is better --- lib/core/src/File.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/core/src/File.cpp b/lib/core/src/File.cpp index b2b5035..6873b88 100644 --- a/lib/core/src/File.cpp +++ b/lib/core/src/File.cpp @@ -248,16 +248,12 @@ namespace ifc auto partition = *cached_partition; return { static_cast(partition.data), partition.size }; } - else if (auto it = table_of_contents_.find(name); it != table_of_contents_.end()) + else { - auto result = get_partition(it->second); + auto result = get_partition(table_of_contents_.at(name)); cached_partition.emplace(result.data(), result.size()); return result; } - else - { - return Partition{nullptr, 0}; - } } std::unordered_map> const & trait_declaration_attributes()