diff --git a/dlls/jscript/jsstr.c b/dlls/jscript/jsstr.c index aad7af29cc4..d34af0feae5 100644 --- a/dlls/jscript/jsstr.c +++ b/dlls/jscript/jsstr.c @@ -72,16 +72,19 @@ jsstr_t *jsstr_concat(jsstr_t *str1, jsstr_t *str2) jsstr_t *ret; len1 = jsstr_length(str1); + if(!len1) + return jsstr_addref(str2); + len2 = jsstr_length(str2); + if(!len2) + return jsstr_addref(str1); ret = jsstr_alloc_buf(len1+len2); if(!ret) return NULL; - if(len1) - memcpy(ret->str, str1->str, len1*sizeof(WCHAR)); - if(len2) - memcpy(ret->str+len1, str2->str, len2*sizeof(WCHAR)); + memcpy(ret->str, str1->str, len1*sizeof(WCHAR)); + memcpy(ret->str+len1, str2->str, len2*sizeof(WCHAR)); return ret; }