Fix string multiplication with a value between 0.0 and 1.0

This commit fixes a regression of 6306ac8966.
This commit is contained in:
itchyny authored and Nico Williams committed 2023-07-08 22:25:22 -05:00
1 parent af57893bc2
commit 88b45771bd
2 files changed
+6 -1

No files matched your search

+2 -1
View File
@@ -360,7 +360,8 @@ static jv f_multiply(jq_state *jq, jv input, jv a, jv b) {
num = a;
}
jv res = jv_null();
int n = jv_number_value(num);
double d = jv_number_value(num);
int n = 0.0 < d && d < 1.0 ? 1 : d;
if (n > 0) {
size_t alen = jv_string_length_bytes(jv_copy(str));
res = jv_string_empty(alen * n);