mirror of https://gitlab.com/pamhyr/pamhyr2
WeatherParameters: Debug crash pamhyr when select a reach without geometry
parent
456559ffe2
commit
c9bb222bff
|
|
@ -397,24 +397,21 @@ class WeatherParameters(SQLSubModel):
|
|||
wp._begin_section = None
|
||||
wp._end_section = None
|
||||
|
||||
if row[3] != -1:
|
||||
if reach not in (-1, None):
|
||||
wp.reach = next(
|
||||
filter(
|
||||
lambda e: e.id == reach,
|
||||
edges
|
||||
)
|
||||
(edge for edge in edges if edge.id == reach), None
|
||||
)
|
||||
profiles = (
|
||||
wp.reach.reach.profiles
|
||||
if wp.reach is not None else []
|
||||
)
|
||||
wp._begin_section = next(
|
||||
filter(
|
||||
lambda p: p.id == b_section,
|
||||
wp.reach.reach.profiles
|
||||
)
|
||||
(profile for profile in profiles
|
||||
if profile.id == b_section), None
|
||||
)
|
||||
wp._end_section = next(
|
||||
filter(
|
||||
lambda p: p.id == e_section,
|
||||
wp.reach.reach.profiles
|
||||
)
|
||||
(profile for profile in profiles
|
||||
if profile.id == e_section), None
|
||||
)
|
||||
|
||||
data["wp"] = wp
|
||||
|
|
@ -537,9 +534,14 @@ class WeatherParameters(SQLSubModel):
|
|||
@reach.setter
|
||||
def reach(self, reach):
|
||||
self._reach = reach
|
||||
self._begin_section = None
|
||||
self._end_section = None
|
||||
|
||||
if reach is not None:
|
||||
self._begin_section = self._reach.reach.profiles[0]
|
||||
self._end_section = self._reach.reach.profiles[-1]
|
||||
profiles = reach.reach.profiles
|
||||
if profiles:
|
||||
self._begin_section = profiles[0]
|
||||
self._end_section = profiles[-1]
|
||||
|
||||
self.modified()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue