From: Paul Brossier Date: Tue, 9 Aug 2005 23:43:39 +0000 (+0000) Subject: fix segfault when file not found X-Git-Tag: bzr2git~852 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b1f723d9cc3647f61a19a2d6413445f6151d6d05;p=aubio.git fix segfault when file not found --- diff --git a/examples/utils.c b/examples/utils.c index 7c8abe0b..f6cb0575 100644 --- a/examples/utils.c +++ b/examples/utils.c @@ -210,7 +210,7 @@ int parse_args (int argc, char **argv) { void examples_common_init(int argc,char ** argv) { - aubio_sndfile_t * onsetfile; + aubio_sndfile_t * onsetfile = NULL; /* parse command line arguments */ parse_args(argc, argv); @@ -219,6 +219,8 @@ void examples_common_init(int argc,char ** argv) { (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) { /* read the output sound once */ aubio_sndfile_read(onsetfile, overlap_size, woodblock); }