From: Paul Brossier Date: Sun, 26 Feb 2017 22:38:49 +0000 (+0100) Subject: src/io/source_wavread.c: avoid seeking in closed file X-Git-Tag: 0.4.5~90 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=cc469dd6c9b7fb66eabb4cde0929270bb54a4f7d;p=aubio.git src/io/source_wavread.c: avoid seeking in closed file --- 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;