diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2014-12-03 20:47:40 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-12-03 11:02:58 -0800 |
commit | 5adc3d2cfdd8b9ca6534198611d1af0d32a015cf (patch) | |
tree | adc11ce9cac4684586f21e9b90c6f228f5835616 | |
parent | 8f224c17373c8714ffeb13127a4e266a47990a16 (diff) | |
download | subsurface-5adc3d2cfdd8b9ca6534198611d1af0d32a015cf.tar.gz |
Fix crash with converted DM5 log
If DM4 log file is converted to DM5, the sampleBlob is empty.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | parse-xml.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/parse-xml.c b/parse-xml.c index 02236113a..a3461687d 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -2082,7 +2082,7 @@ extern int dm5_dive(void *param, int columns, char **data, char **column) interval = data[16] ? atoi(data[16]) : 0; sampleBlob = (unsigned const char *)data[17]; - for (i = 0; interval && i * interval < cur_dive->duration.seconds; i++) { + for (i = 0; interval && sampleBlob && i * interval < cur_dive->duration.seconds; i++) { float *depth = (float *)&sampleBlob[i * 16 + 3]; int32_t temp = (sampleBlob[i * 16 + 10] << 8) + sampleBlob[i * 16 + 11]; int32_t pressure = (sampleBlob[i * 16 + 9] << 16) + (sampleBlob[i * 16 + 8] << 8) + sampleBlob[i * 16 + 7]; |