summaryrefslogtreecommitdiff
path: root/src/core/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/string.c')
-rw-r--r--src/core/string.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/string.c b/src/core/string.c
index 2540e26..3d30e3f 100644
--- a/src/core/string.c
+++ b/src/core/string.c
@@ -89,6 +89,14 @@ dom_exception dom_string_create(dom_alloc alloc, void *pw,
{
struct dom_string *ret;
+ if (ptr == NULL && len == 0) {
+ dom_string_ref(&empty_string);
+
+ *str = &empty_string;
+
+ return DOM_NO_ERR;
+ }
+
ret = alloc(NULL, sizeof(struct dom_string), pw);
if (ret == NULL)
return DOM_NO_MEM_ERR;