From f0a04b05469e2e097a5dafffe6f48c80be152828 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Mon, 18 Dec 2023 20:25:40 -0600 Subject: [PATCH 1/2] Provide error message if a cell path can't be determined --- src/geometry_aux.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/geometry_aux.cpp b/src/geometry_aux.cpp index 98dfc12a763..87b5f3ffc0e 100644 --- a/src/geometry_aux.cpp +++ b/src/geometry_aux.cpp @@ -544,6 +544,13 @@ std::string distribcell_path_inner(int32_t target_cell, int32_t map, } } + // if we get through the loop without finding an appropriate entry, throw + // an error + if (cell_it == search_univ.cells_.crend()) { + fatal_error(fmt::format("Failed to generate a text label for distribcell with ID {}." + "The current label is: '{}'", model::cells[target_cell]->id_, path.str())); + } + // Add the cell to the path string. Cell& c = *model::cells[*cell_it]; path << "c" << c.id_ << "->"; From 0ddb1f4f190ab1979f5a87f7b77a0df5a52724c1 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Mon, 18 Dec 2023 20:40:10 -0600 Subject: [PATCH 2/2] Format --- src/geometry_aux.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/geometry_aux.cpp b/src/geometry_aux.cpp index 87b5f3ffc0e..b0e88e8e36c 100644 --- a/src/geometry_aux.cpp +++ b/src/geometry_aux.cpp @@ -547,8 +547,10 @@ std::string distribcell_path_inner(int32_t target_cell, int32_t map, // if we get through the loop without finding an appropriate entry, throw // an error if (cell_it == search_univ.cells_.crend()) { - fatal_error(fmt::format("Failed to generate a text label for distribcell with ID {}." - "The current label is: '{}'", model::cells[target_cell]->id_, path.str())); + fatal_error( + fmt::format("Failed to generate a text label for distribcell with ID {}." + "The current label is: '{}'", + model::cells[target_cell]->id_, path.str())); } // Add the cell to the path string.