Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fiterx json array fix - unwanted NULL results in get_subscript #273

Merged
merged 2 commits into from
Sep 4, 2024

Conversation

bshifter
Copy link
Member

@bshifter bshifter commented Sep 4, 2024

The FilterXJsonArray, which inherits from FilterXList, performed a redundant range check in the get_subscript method, leading to incorrect NULL results in certain cases due to a bug. Since this range check is already handled in the FilterXList abstraction, the unnecessary and faulty code block has been removed.

Additionally, some end-to-end tests for range checks have been added.

Fixed multiple issues in the original solution.
1. The conditional check for the index argument being in range was incorrect.
The correct condition should have been `json_object_array_length(self->jso) < index + 1` to function as intended.
2. The range check was redundant. Since `object-json-array` inherits
from `filterx-list-interface`, the range check is already properly
implemented there.

Signed-off-by: shifter <shifter@axoflow.com>
Signed-off-by: shifter <shifter@axoflow.com>
@alltilla alltilla merged commit e379056 into axoflow:main Sep 4, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants