From cea30b8952f7aa2d7f5c4c8b27f34f1ee1fb5053 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Thu, 1 Nov 2007 15:14:29 +0100 Subject: [PATCH] aubioclass.py: make sndfile raise error if file not opened, do not delete it if == None, avoiding several segfaults --- python/aubio/aubioclass.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/aubio/aubioclass.py b/python/aubio/aubioclass.py index 4269e29a..b6e5be38 100644 --- a/python/aubio/aubioclass.py +++ b/python/aubio/aubioclass.py @@ -42,8 +42,9 @@ class sndfile: self.file = new_aubio_sndfile_wo(model.file,filename) else: self.file = new_aubio_sndfile_ro(filename) + if self.file == None: raise(ValueError, "failed opening file") def __del__(self): - del_aubio_sndfile(self.file) + if self.file != None: del_aubio_sndfile(self.file) def info(self): aubio_sndfile_info(self.file) def samplerate(self): -- 2.26.2