diff --git a/libmat2/audio.py b/libmat2/audio.py index bd7add9..3f3a757 100644 --- a/libmat2/audio.py +++ b/libmat2/audio.py @@ -13,7 +13,8 @@ class MutagenParser(abstract.AbstractParser): def __init__(self, filename): super().__init__(filename) try: - mutagen.File(self.filename) + if mutagen.File(self.filename) is None: + raise ValueError except mutagen.MutagenError: raise ValueError diff --git a/libmat2/images.py b/libmat2/images.py index e55b765..c584c1c 100644 --- a/libmat2/images.py +++ b/libmat2/images.py @@ -26,7 +26,10 @@ class SVGParser(exiftool.ExiftoolParser): } def remove_all(self) -> bool: - svg = Rsvg.Handle.new_from_file(self.filename) + try: + svg = Rsvg.Handle.new_from_file(self.filename) + except GLib.GError: + raise ValueError dimensions = svg.get_dimensions() surface = cairo.SVGSurface(self.output_filename, dimensions.height,