Skip to content

Commit

Permalink
part editor: don't crash if there are no parametric columns
Browse files Browse the repository at this point in the history
changelog: Bugfixes/Part Editor: don't crash if there are no parametric tables and columns
  • Loading branch information
carrotIndustries committed Jan 4, 2024
1 parent d71b14a commit 5fad78a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/pool-prj-mgr/pool-mgr/editors/part_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,10 @@ PartEditor::PartEditor(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder>

{
namespace rv = ranges::views;
const auto maxlen =
ranges::max(pool_parametric.get_tables() | rv::transform([](const auto &x) { return x.second.columns; })
| rv::join | rv::transform([](const auto &x) { return x.display_name.size(); }));
const auto maxlen = ranges::max(ranges::views::concat(
ranges::views::single(0),
pool_parametric.get_tables() | rv::transform([](const auto &x) { return x.second.columns; }) | rv::join
| rv::transform([](const auto &x) { return x.display_name.size(); })));
Gtk::Label *la;
x->get_widget("label_table", la);
la->set_width_chars(maxlen);
Expand Down

0 comments on commit 5fad78a

Please sign in to comment.