From b1f723d9cc3647f61a19a2d6413445f6151d6d05 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Tue, 9 Aug 2005 23:43:39 +0000 Subject: [PATCH] fix segfault when file not found --- examples/utils.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); } -- 2.26.2