From 0d4087fdde88bc3dfad8921f2016b2f346f3d7c7 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sat, 22 Oct 2022 18:41:40 +0200 Subject: [PATCH] Detect if no path exists --- brood/src/commands/path.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/brood/src/commands/path.rs b/brood/src/commands/path.rs index 724339a..a8cb8dd 100644 --- a/brood/src/commands/path.rs +++ b/brood/src/commands/path.rs @@ -127,12 +127,11 @@ fn dijkstra( }; } steps.reverse(); - Some(steps) - // if steps.first() == Some(&from_idx) { - // Some(steps) - // } else { - // None - // } + if steps.first() == Some(&from_idx) { + Some(steps) + } else { + None + } } pub fn path(datafile: &Path, from: &str, to: &str) -> io::Result<()> {