diff --git a/src/models/relay.rs b/src/models/relay.rs index 5cb97d1..0b3e16c 100644 --- a/src/models/relay.rs +++ b/src/models/relay.rs @@ -113,7 +113,9 @@ impl Relay { } } - self.active_schedule = Some(self.schedules.get(weekday as usize).unwrap().clone()) + if let Some(schedule) = self.schedules.get(weekday as usize) { + self.active_schedule = Some(schedule.clone()); + } } pub fn apply_state(&mut self, state: &RelayState) {