From 3b115b94009e9a674681145b324a46d51432a788 Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Mon, 9 Dec 2013 07:42:51 +0100 Subject: [PATCH] Don't crash when trying to open a empty file Signed-off-by: Anton Lundin Signed-off-by: Dirk Hohndel --- file.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/file.c b/file.c index aaf14f3d9..a8c014235 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); }