From 9433fea80df9f6277114d2c27795c35450ad7880 Mon Sep 17 00:00:00 2001 From: Alex Pasmantier <47638216+alexpasmantier@users.noreply.github.com> Date: Thu, 9 Jan 2025 20:41:11 +0100 Subject: [PATCH] fix(cable): filter out non-utf8 lines when loading cable candidates (#263) Fixes #262 --- crates/television-channels/src/channels/cable.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/crates/television-channels/src/channels/cable.rs b/crates/television-channels/src/channels/cable.rs index 2f0f36f..8ec848c 100644 --- a/crates/television-channels/src/channels/cable.rs +++ b/crates/television-channels/src/channels/cable.rs @@ -117,13 +117,15 @@ async fn load_candidates(command: String, injector: Injector) { let reader = BufReader::new(out); let mut produced_output = false; + #[allow(clippy::manual_flatten)] for line in reader.lines() { - let line = line.unwrap(); - if !line.trim().is_empty() { - let () = injector.push(line, |e, cols| { - cols[0] = e.clone().into(); - }); - produced_output = true; + if let Ok(l) = line { + if !l.trim().is_empty() { + let () = injector.push(l, |e, cols| { + cols[0] = e.clone().into(); + }); + produced_output = true; + } } }