summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2021-11-18 14:24:55 +0100
committerKostya Shishkov <kostya.shishkov@gmail.com>2021-11-18 14:24:55 +0100
commitb2d3e848c0984925382081499ddf518ae22f2641 (patch)
treeff1611894434a596b6293af9cff9386f51aa27e3
parente08bbe032e8553d872673701f016d1bcf3070312 (diff)
downloadnihav-player-b2d3e848c0984925382081499ddf518ae22f2641.tar.gz
add a check for empty or special files
-rw-r--r--sndplay/src/main.rs4
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>;