mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 20:23:25 +00:00
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>
This commit is contained in:
parent
44848d5457
commit
3b115b9400
1 changed files with 3 additions and 0 deletions
3
file.c
3
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))
|
if (fmt && open_by_filename(filename, fmt+1, mem, error))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!mem->size || !mem->buffer)
|
||||||
|
return;
|
||||||
|
|
||||||
parse_xml_buffer(filename, mem->buffer, mem->size, &dive_table, NULL, error);
|
parse_xml_buffer(filename, mem->buffer, mem->size, &dive_table, NULL, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue