summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEmanuele Torre <torreemanuele6@gmail.com>2023-09-28 05:32:41 +0200
committerNico Williams <nico@cryptonector.com>2023-09-27 22:54:23 -0500
commit6b5a18f0369eb765c1c9542cc886d389dac66c50 (patch)
treef6c0c52994f63bfab8ead77191d226a99c90176c /src
parent8206bc8fd2302715cb0948a4468996aecc3c5f7a (diff)
Actually use number correctly casted from double to int as index
The code was using (int)jv_number_value(k) instead of (int)didx. follow-up from 0e067ef93605493060392f0999be27694146fca4 Useless assignments to didx detected by clang-tidy.
Diffstat (limited to 'src')
-rw-r--r--src/jv_aux.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/jv_aux.c b/src/jv_aux.c
index 0b7d169d..5ec7ce8e 100644
--- a/src/jv_aux.c
+++ b/src/jv_aux.c
@@ -95,7 +95,7 @@ jv jv_get(jv t, jv k) {
} else {
if (didx < INT_MIN) didx = INT_MIN;
if (didx > INT_MAX) didx = INT_MAX;
- int idx = (int)jv_number_value(k);
+ int idx = (int)didx;
if (idx < 0)
idx += jv_array_length(jv_copy(t));
v = jv_array_get(t, idx);