diff --git a/birdvisu/annotations/__init__.py b/birdvisu/annotations/__init__.py index 667572c..ad07088 100644 --- a/birdvisu/annotations/__init__.py +++ b/birdvisu/annotations/__init__.py @@ -77,8 +77,14 @@ class AnnotatedTopology: raise ValueError('Annotator fakes its ID!') annotation.annotator_id = ann_id for v in annotation.for_vertex: + if v not in self.topology.vertices: + print(f'WARNING: vertex not in the topology, skipping. {ann_id=}, {v=}') + continue self.vertex_annotators[v].add(ann_id) for e in annotation.for_edge: + if e not in self.topology.edges: + print(f'WARNING: edge not in the topology, skipping. {ann_id=} {e}') + continue self.edge_annotators[e].add(ann_id) if annotation.for_topology is not None: self.global_annotators.add(ann_id)