From 9af07aa2479802801ede3488493b92b777000010 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Fri, 21 Jul 2006 13:58:26 +0000 Subject: [PATCH] exit from examples when woodblock or input files not found exit from examples when woodblock or input files not found --- examples/utils.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/utils.c b/examples/utils.c index 616c9e3a..ba7fac39 100644 --- a/examples/utils.c +++ b/examples/utils.c @@ -253,6 +253,10 @@ void examples_common_init(int argc,char ** argv) { isonset = (onsetfile = new_aubio_sndfile_ro(onset_filename)) || (onsetfile = new_aubio_sndfile_ro("sounds/woodblock.aiff")) || (onsetfile = new_aubio_sndfile_ro("../sounds/woodblock.aiff")); + if (onsetfile == NULL) { + outmsg("Could not find woodblock.aiff\n"); + exit(1); + } } if (onsetfile) { /* read the output sound once */ @@ -263,6 +267,10 @@ void examples_common_init(int argc,char ** argv) { { debug("Opening files ...\n"); file = new_aubio_sndfile_ro (input_filename); + if (file == NULL) { + outmsg("Could not open input file %s.\n", input_filename); + exit(1); + } if (verbose) aubio_sndfile_info(file); channels = aubio_sndfile_channels(file); samplerate = aubio_sndfile_samplerate(file); -- 2.26.2