]> git.corax.cc Git - toolbox/commit
include/json: Fix error handling in json_array_head()
authorMatthias Kruk <m@m10k.eu>
Sat, 7 Jan 2023 07:54:55 +0000 (16:54 +0900)
committerMatthias Kruk <m@m10k.eu>
Sat, 7 Jan 2023 08:03:26 +0000 (17:03 +0900)
commit7209457792db2a23282dfd39c148e0ffcc4e2b40
treef9b6c744eebd04eadd31de33107b6ccbd227155e
parent2e20d08a33f780c68dd29e30b81efd8249976dda
include/json: Fix error handling in json_array_head()

Because json_array_head() does not correctly check the return value
from jq, it does not correctly detect if an array is empty.

This commit fixes the function so that it does not rely on the return
value from `jq -e', since it returns an error if the boolean value false
was retrieved.
include/json.sh