diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2015-03-08 21:40:30 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-03-08 12:55:22 -0700 |
commit | 0ebfcfdf681ad0e93a49d64320fe575d24e5b0d6 (patch) | |
tree | 6e709abbda430afc92bfa9a2d9496730799da98d /liquivision.c | |
parent | c67812acc32fdaceeae80296edb7239b9e575406 (diff) | |
download | subsurface-0ebfcfdf681ad0e93a49d64320fe575d24e5b0d6.tar.gz |
Fix a crash on Liquivision import
Without the patch, there is a crash if the dive does not have a
location.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'liquivision.c')
-rw-r--r-- | liquivision.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/liquivision.c b/liquivision.c index 7126c9b79..2f1bb00ad 100644 --- a/liquivision.c +++ b/liquivision.c @@ -137,8 +137,12 @@ static void parse_dives (int log_version, const unsigned char *buf, unsigned int } else if (place_len) { location = strndup(buf + ptr + len + 4, place_len); } - dive->dive_site_uuid = create_dive_site(location); - free(location); + + /* Store the location only if we have one */ + if (len || place_len) { + dive->dive_site_uuid = create_dive_site(location); + free(location); + } ptr += len + 4 + place_len; |