mirror of
https://git.alemi.dev/fedicharter.git
synced 2024-11-22 16:34:49 +01:00
fix: skip vertices to invalid nodes
This commit is contained in:
parent
5adeda80ca
commit
92b2075c9d
1 changed files with 14 additions and 6 deletions
20
src/model.rs
20
src/model.rs
|
@ -44,15 +44,23 @@ impl MapCollector {
|
|||
|
||||
for vertex in vertices_domains {
|
||||
let from = {
|
||||
let node = nodes_map.get_mut(&vertex.from).expect("vertex from non existing node");
|
||||
node.value += 1;
|
||||
node.id
|
||||
if let Some(node) = nodes_map.get_mut(&vertex.from) {
|
||||
node.value += 1;
|
||||
node.id
|
||||
} else {
|
||||
tracing::warn!("vertex from nonexisting node {}", vertex.from);
|
||||
continue;
|
||||
}
|
||||
};
|
||||
|
||||
let to = {
|
||||
let node = nodes_map.get_mut(&vertex.to).expect("vertex to non existing node");
|
||||
node.value += 5;
|
||||
node.id
|
||||
if let Some(node) = nodes_map.get_mut(&vertex.to) {
|
||||
node.value += 5;
|
||||
node.id
|
||||
} else {
|
||||
tracing::warn!("vertex to nonexisting node {}", vertex.to);
|
||||
continue;
|
||||
}
|
||||
};
|
||||
|
||||
vertices.push(Vertex { from, to });
|
||||
|
|
Loading…
Reference in a new issue