From d17c8c4585c9decb11e31b3102112c956e1b7078 Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Mon, 10 Jul 2023 10:42:50 +0200 Subject: [PATCH] Guard against bad edges being added to topology --- birdvisu/topo_v3.py | 1 + 1 file changed, 1 insertion(+) diff --git a/birdvisu/topo_v3.py b/birdvisu/topo_v3.py index da7eb8c..32126ab 100644 --- a/birdvisu/topo_v3.py +++ b/birdvisu/topo_v3.py @@ -78,6 +78,7 @@ class TopologyV3: def add_edge(self, edge): if self.frozen: raise ValueError('Cannot add edge to frozen topology.') + if edge.count <= 0: raise ValueError('Must not add non-existent edges') # We need to merge relevant edges. Thus, this is more like adding a # multi-edge, which falls to no-op when the specific edge is already # present. In other words, this means that we _may_ have multiple Edge