From 16633bdc25973c4e89c39e41158711479bdbb147 Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Wed, 5 Mar 2025 16:05:09 +0100 Subject: Fix unwrap on missing task --- src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 7bce3c7..b11ee27 100644 --- a/src/main.rs +++ b/src/main.rs @@ -239,7 +239,9 @@ impl<'a> Scheduler<'a> { self.dispatch_next_task(); for (pid, parent) in self.reciever.try_iter() { - self.managed_tasks.get_mut(&(pid as u32)).unwrap().parent = parent as u32; + if let Some(task) = self.managed_tasks.get_mut(&(pid as u32)) { + task.parent = parent as u32; + } } // If no task is ready to run (or in case of error), stop dispatching tasks and notify -- cgit v1.3.1