Qt turns edited locations into null-strings

They aren't null pointers after you touched them, so we can't rely on
that to choose if we should use put_string or show_utf8.
show_utf8 would not print the tag if it only contains a \0 as body.

Fixes #440

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Anton Lundin 2014-05-07 00:27:51 +02:00 committed by Dirk Hohndel
parent 7c3b68e3ae
commit 868827f5ec

View file

@ -190,7 +190,7 @@ static void show_location(struct membuffer *b, struct dive *dive)
int len = sprintf(buffer, " <location ");
len += format_location(buffer + len, latitude, longitude);
if (!dive->location) {
if (!dive->location || dive->location[0] == '\0') {
memcpy(buffer + len, "/>\n\0", 5);
put_string(b, buffer);
return;