From 23f2db700575786bc111a28a963e2e240d90c534 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Mon, 29 Apr 2013 22:12:07 +0200 Subject: Mat now correctly handle empty files This is necessary beccause hachoir crashes on empty files... --- MAT/mat.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'MAT') diff --git a/MAT/mat.py b/MAT/mat.py index 3a0938a..8c92a33 100644 --- a/MAT/mat.py +++ b/MAT/mat.py @@ -125,6 +125,11 @@ def create_class_file(name, backup, **kwargs): logging.error('%s is not writtable' % name) return None + if not os.path.getsize(name): + #check if the file is not empty (hachoir crash on empty files) + logging.error('%s is empty' % name) + return None + filename = '' try: filename = hachoir_core.cmd_line.unicodeFilename(name) -- cgit v1.3