From b0565a8ae63e327f56a0a5ed04940f9c76eff08a Mon Sep 17 00:00:00 2001 From: Hofer-Julian Date: Wed, 13 Mar 2024 10:09:10 +0100 Subject: [PATCH] Return instead of crash when trying to plot model without edges --- python/ribasim/ribasim/geometry/edge.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/ribasim/ribasim/geometry/edge.py b/python/ribasim/ribasim/geometry/edge.py index e905933c3..710503338 100644 --- a/python/ribasim/ribasim/geometry/edge.py +++ b/python/ribasim/ribasim/geometry/edge.py @@ -79,7 +79,8 @@ def get_where_edge_type(self, edge_type: str) -> NDArray[np.bool_]: return (self.df.edge_type == edge_type).to_numpy() def plot(self, **kwargs) -> Axes: - assert self.df is not None # Pleases mypy + if self.df is None: + return kwargs = kwargs.copy() # Avoid side-effects ax = kwargs.get("ax", None) color_flow = kwargs.pop("color_flow", None)