From 5f574cf283816bb5b745a761ffb4d2e923fbc7bf Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Sat, 28 Mar 2020 02:38:10 +0300 Subject: [PATCH] get_next_media: replace indexing with .get() --- src/chat.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chat.rs b/src/chat.rs index 4197b4142..ffce31db3 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -1743,12 +1743,12 @@ pub fn get_next_media( match direction { Direction::Forward => { if i + 1 < list.len() { - ret = Some(list[i + 1]); + ret = list.get(i + 1).copied(); } } Direction::Backward => { if i >= 1 { - ret = Some(list[i - 1]); + ret = list.get(i - 1).copied(); } } }