[PATCH] Give proper error message when no dives on a zip

Miika Turkia miika.turkia at gmail.com
Sat Oct 31 10:29:41 PDT 2015


We import a few logs that are archived in a zip file. E.g. divelogs.de
import is a zip file named with .dld extension. In case the zip file is
empty, we should return an error message that states that fact, not
parse error. This will also end the input file parsing cleaning up
the error message on the console.

Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 file.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/file.c b/file.c
index c4032c1..0263da4 100644
--- a/file.c
+++ b/file.c
@@ -105,6 +105,9 @@ int try_to_open_zip(const char *filename, struct memblock *mem)
 			success++;
 		}
 		subsurface_zip_close(zip);
+
+		if (!success)
+			return report_error(translate("gettextFromC", "No dives in the input file '%s'"), filename);
 	}
 	return success;
 }
-- 
2.5.0



More information about the subsurface mailing list