diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2021-11-18 14:24:55 +0100 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2021-11-18 14:24:55 +0100 |
commit | b2d3e848c0984925382081499ddf518ae22f2641 (patch) | |
tree | ff1611894434a596b6293af9cff9386f51aa27e3 | |
parent | e08bbe032e8553d872673701f016d1bcf3070312 (diff) | |
download | nihav-player-b2d3e848c0984925382081499ddf518ae22f2641.tar.gz |
add a check for empty or special files
-rw-r--r-- | sndplay/src/main.rs | 4 |
1 files changed, 4 insertions, 0 deletions
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<dyn ByteIO>; |