BC: Fix get_assoc_to_node in case of no results.

setup.py
Pierre-Antoine Rouby 2023-11-27 09:21:23 +01:00
parent 08f01aee69
commit a88b42a8ef
1 changed files with 6 additions and 1 deletions

View File

@ -91,9 +91,14 @@ class BoundaryConditionList(PamhyrModelListWithTab):
return copy(self) return copy(self)
def get_assoc_to_node(self, tab, node): def get_assoc_to_node(self, tab, node):
return next( assoc = list(
filter( filter(
lambda i: i.node is node, lambda i: i.node is node,
self._tabs[tab] self._tabs[tab]
) )
) )
if len(assoc) > 0:
return assoc[0]
return None