From b2d3e848c0984925382081499ddf518ae22f2641 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Thu, 18 Nov 2021 14:24:55 +0100 Subject: [PATCH] add a check for empty or special files --- sndplay/src/main.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sndplay/src/main.rs b/sndplay/src/main.rs index b58577f..c8e75a4 100644 --- a/sndplay/src/main.rs +++ b/sndplay/src/main.rs @@ -244,6 +244,10 @@ impl Player { let mut fr = FileReader::new_read(file); let mut br = ByteReader::new(&mut fr); + if br.peek_byte().is_err() { + println!("Cannot read {}", name); + return; + } let (is_raw, start, end) = detect_tags(&mut br); let mut nfr: Box; -- 2.39.5