Commit 70d739416b3a5c985cb6a401ee5553fc1d996dc7

Martin Mitas 2017-07-22T00:56:23

md_build_attribute: Propagate NULL string if attribute is empty.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/md4c/md4c.c b/md4c/md4c.c
index 3c1f746..e0f5ffe 100644
--- a/md4c/md4c.c
+++ b/md4c/md4c.c
@@ -1435,7 +1435,7 @@ md_build_attribute(MD_CTX* ctx, const CHAR* raw_text, SZ raw_size,
     }
 
     if(is_trivial) {
-        build->text = (CHAR*) raw_text;
+        build->text = (CHAR*) (raw_size ? raw_text : NULL);
         build->substr_types = build->trivial_types;
         build->substr_offsets = build->trivial_offsets;
         build->substr_count = 1;