Skip to content

Commit ddb7565

Browse files
committed
Short-circuit empty string normalization
1 parent 6d88ddd commit ddb7565

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎priv/c_src/quickjs.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47854,6 +47854,11 @@ static JSValue js_string_normalize(JSContext *ctx, JSValueConst this_val,
4785447854
JS_FreeCString(ctx, form);
4785547855
}
4785647856

47857+
if (buf_len == 0) {
47858+
js_free(ctx, buf);
47859+
return JS_NewStringLen(ctx, "", 0);
47860+
}
47861+
4785747862
out_len = unicode_normalize(&out_buf, buf, buf_len, n_type,
4785847863
ctx->rt, (DynBufReallocFunc *)js_realloc_rt);
4785947864
js_free(ctx, buf);

0 commit comments

Comments
 (0)