From: Peter Verthez Date: Sat, 21 Dec 2002 15:34:27 +0000 (+0000) Subject: Small fix for empty values in write_long. X-Git-Url: https://git.dlugolecki.net.pl/?a=commitdiff_plain;h=23d48363096b73555bf51f75790e3d97ba123ba1;p=gedcom-parse.git Small fix for empty values in write_long. --- diff --git a/gedcom/write.c b/gedcom/write.c index f8721da..69d502e 100644 --- a/gedcom/write.c +++ b/gedcom/write.c @@ -127,13 +127,14 @@ int supports_continuation(int elt_or_rec, int which_continuation) int write_long(Gedcom_write_hndl hndl, int elt_or_rec, int level, char* xref, char* tag, char* value) { - int prefix_len, value_len, term_len; - char* nl_pos = strchr(value, '\n'); + int prefix_len, value_len = 0, term_len; + char* nl_pos = NULL; + if (value) nl_pos = strchr(value, '\n'); prefix_len = utf8_strlen(tag) + 3; /* for e.g. "0 INDI " */ if (level > 9) prefix_len++; if (xref) prefix_len += utf8_strlen(xref) + 1; - value_len = utf8_strlen(value); + if (value) value_len = utf8_strlen(value); term_len = strlen(hndl->term); if (!nl_pos && prefix_len + value_len + term_len <= MAXWRITELEN)