Hydraulic structure: fix crashing bug happening when we select the section combobox without selecting a reach in the first combobox

This commit is contained in:
Dylan Jeannin committed 2026-09-01 14:53:08 +02:00
1 parent 32db5795da
commit d6aeb5df21
1 file changed
+9 -6
+9 -6
View File
@@ -96,14 +96,17 @@ class ComboBoxDelegate(QItemDelegate):
reach = self._data.hydraulic_structures\
.get_for_enabled_reaches(index.row())\
.input_reach
profiles = list(
filter(
lambda p: p.display_name() == text,
reach.reach.profiles
if reach is None:
value = None
else:
profiles = list(
filter(
lambda p: p.display_name() == text,
reach.reach.profiles
)
)
)
value = profiles[0] if len(profiles) > 0 else None
value = profiles[0] if len(profiles) > 0 else None
else:
value = text