From 2c4fa4aead4b7f7ec4857f22c0e3d175c81e1235 Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Wed, 29 May 2019 09:29:46 +0100 Subject: [PATCH] Return empty dict if capture is corrupt --- openflexure_microscope/camera/capture.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openflexure_microscope/camera/capture.py b/openflexure_microscope/camera/capture.py index bf26fb03..5bfc68b4 100644 --- a/openflexure_microscope/camera/capture.py +++ b/openflexure_microscope/camera/capture.py @@ -49,6 +49,7 @@ def pull_usercomment_dict(filepath): exif_dict = piexif.load(filepath) except InvalidImageDataError: logging.error("Invalid data at {}. Skipping.".format(filepath)) + return {} if 'Exif' in exif_dict and 37510 in exif_dict['Exif']: return yaml.load(exif_dict['Exif'][37510].decode()) else: