瀏覽代碼

Minor xs_html tweak.

default 1 月之前
父節點
當前提交
d9b6b7ce08
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      xs_html.h

+ 2 - 2
xs_html.h

@@ -114,7 +114,7 @@ xs_html *xs_html_text(const char *content)
     xs_html *a = XS_HTML_NEW();
 
     a->type    = XS_HTML_TEXT;
-    a->content = xs_html_encode(content);
+    a->content = xs_is_string(content) ? xs_html_encode(content) : xs_str_new(NULL);
 
     return a;
 }
@@ -126,7 +126,7 @@ xs_html *xs_html_raw(const char *content)
     xs_html *a = XS_HTML_NEW();
 
     a->type    = XS_HTML_TEXT;
-    a->content = xs_dup(content);
+    a->content = xs_is_string(content) ? xs_dup(content) : xs_str_new(NULL);
 
     return a;
 }