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._begin_section = None
|
||||||
wp._end_section = None
|
wp._end_section = None
|
||||||
|
|
||||||
if row[3] != -1:
|
if reach not in (-1, None):
|
||||||
wp.reach = next(
|
wp.reach = next(
|
||||||
filter(
|
(edge for edge in edges if edge.id == reach), None
|
||||||
lambda e: e.id == reach,
|
|
||||||
edges
|
|
||||||
)
|
)
|
||||||
|
profiles = (
|
||||||
|
wp.reach.reach.profiles
|
||||||
|
if wp.reach is not None else []
|
||||||
)
|
)
|
||||||
wp._begin_section = next(
|
wp._begin_section = next(
|
||||||
filter(
|
(profile for profile in profiles
|
||||||
lambda p: p.id == b_section,
|
if profile.id == b_section), None
|
||||||
wp.reach.reach.profiles
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
wp._end_section = next(
|
wp._end_section = next(
|
||||||
filter(
|
(profile for profile in profiles
|
||||||
lambda p: p.id == e_section,
|
if profile.id == e_section), None
|
||||||
wp.reach.reach.profiles
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
data["wp"] = wp
|
data["wp"] = wp
|
||||||
|
|
@ -537,9 +534,14 @@ class WeatherParameters(SQLSubModel):
|
||||||
@reach.setter
|
@reach.setter
|
||||||
def reach(self, reach):
|
def reach(self, reach):
|
||||||
self._reach = reach
|
self._reach = reach
|
||||||
|
self._begin_section = None
|
||||||
|
self._end_section = None
|
||||||
|
|
||||||
if reach is not None:
|
if reach is not None:
|
||||||
self._begin_section = self._reach.reach.profiles[0]
|
profiles = reach.reach.profiles
|
||||||
self._end_section = self._reach.reach.profiles[-1]
|
if profiles:
|
||||||
|
self._begin_section = profiles[0]
|
||||||
|
self._end_section = profiles[-1]
|
||||||
|
|
||||||
self.modified()
|
self.modified()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue