get_next_media: replace indexing with .get()

This commit is contained in:
Alexander Krotov
2020-03-28 02:38:10 +03:00
committed by Alexander Krotov
parent 92f1e6da1e
commit 5f574cf283

View File

@@ -1743,12 +1743,12 @@ pub fn get_next_media(
match direction { match direction {
Direction::Forward => { Direction::Forward => {
if i + 1 < list.len() { if i + 1 < list.len() {
ret = Some(list[i + 1]); ret = list.get(i + 1).copied();
} }
} }
Direction::Backward => { Direction::Backward => {
if i >= 1 { if i >= 1 {
ret = Some(list[i - 1]); ret = list.get(i - 1).copied();
} }
} }
} }