summaryrefslogtreecommitdiffstats
path: root/core/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/file.c')
-rw-r--r--core/file.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/core/file.c b/core/file.c
index e818c9e21..d604f94cd 100644
--- a/core/file.c
+++ b/core/file.c
@@ -927,6 +927,11 @@ int parse_dan_format(const char *filename, char **params, int pnr)
++iter;
}
+ if (!iter) {
+ fprintf(stderr, "DEBUG: Data corrupt");
+ return -1;
+ }
+
/* Setting date */
memcpy(tmpbuf, iter, 8);
tmpbuf[8] = 0;
@@ -950,9 +955,12 @@ int parse_dan_format(const char *filename, char **params, int pnr)
}
if (ptr)
ptr = strstr(ptr, NL);
- if (ptr)
+ if (ptr) {
ptr += strlen(NL);
-
+ } else {
+ fprintf(stderr, "DEBUG: Data corrupt");
+ return -1;
+ }
end_ptr = ptr - (char *)mem.buffer;
/* Copy the current dive data to start of mem_csv buffer */