summaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2013-12-09 07:42:51 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-09 07:50:52 +0100
commit3b115b94009e9a674681145b324a46d51432a788 (patch)
treeeafd09bd78fdb0df505ab5e4c91a281738c800b1 /file.c
parent44848d5457b904a77e35fa0b93268a581b933b23 (diff)
downloadsubsurface-3b115b94009e9a674681145b324a46d51432a788.tar.gz
Don't crash when trying to open a empty file
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'file.c')
-rw-r--r--file.c3
1 files changed, 3 insertions, 0 deletions
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);
}