From cc469dd6c9b7fb66eabb4cde0929270bb54a4f7d Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sun, 26 Feb 2017 23:38:49 +0100 Subject: [PATCH] src/io/source_wavread.c: avoid seeking in closed file --- src/io/source_wavread.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/io/source_wavread.c b/src/io/source_wavread.c index 2b7f8116..344f9a83 100644 --- a/src/io/source_wavread.c +++ b/src/io/source_wavread.c @@ -407,6 +407,10 @@ uint_t aubio_source_wavread_get_channels(aubio_source_wavread_t * s) { uint_t aubio_source_wavread_seek (aubio_source_wavread_t * s, uint_t pos) { uint_t ret = 0; + if (s->fid == NULL) { + AUBIO_ERR("source_wavread: could not seek %s (file not opened?)\n", s->path, pos); + return AUBIO_FAIL; + } if ((sint_t)pos < 0) { AUBIO_ERR("source_wavread: could not seek %s at %d (seeking position should be >= 0)\n", s->path, pos); return AUBIO_FAIL; -- 2.11.0