From d6aeb5df212b3a8268b5d5b52ecc1cc4f2cf4c6c Mon Sep 17 00:00:00 2001 From: Dylan Jeannin Date: Tue, 1 Sep 2026 14:53:08 +0200 Subject: [PATCH] Hydraulic structure: fix crashing bug happening when we select the section combobox without selecting a reach in the first combobox --- src/View/HydraulicStructures/Table.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/View/HydraulicStructures/Table.py b/src/View/HydraulicStructures/Table.py index 13a3057e..c955e2a2 100644 --- a/src/View/HydraulicStructures/Table.py +++ b/src/View/HydraulicStructures/Table.py @@ -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