[PATCH] Don't crash when trying to open a empty file

Anton Lundin glance at acc.umu.se
Sun Dec 8 22:42:51 UTC 2013


Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
 file.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/file.c b/file.c
index aaf14f3..a8c0142 100644
--- a/file.c
+++ b/file.c
@@ -291,6 +291,9 @@ static void parse_file_buffer(const char *filename, struct memblock *mem, char *
 	if (fmt && open_by_filename(filename, fmt+1, mem, error))
 		return;
 
+	if (!mem->size || !mem->buffer)
+		return;
+
 	parse_xml_buffer(filename, mem->buffer, mem->size, &dive_table, NULL, error);
 }
 
-- 
1.8.3.2



More information about the subsurface mailing list