Skip to content

Conversation

@stklcode
Copy link
Owner

Calling mapOf() with an odd number of arguments results in an IndexOutOfBoundsException.

Checking the arguments and throwing a custom exception might be an option as well, but given this is some internal helper method, let's just do it like we already do in mapOfStrings() and fix the loop condition. This way we interpret an odd number of arguments as key without value and omit as as we do with nulls by design.

@stklcode stklcode added this to the 1.5.3 milestone Aug 30, 2025
@stklcode stklcode self-assigned this Aug 30, 2025
@stklcode stklcode added the bug label Aug 30, 2025
@sonarqubecloud
Copy link

@stklcode stklcode changed the title fix: prevent potential off-by-1 error in internal mapOf() helper (#107) fix: prevent potential off-by-1 error in internal mapOf() helper Aug 30, 2025
@stklcode stklcode merged commit bac06c5 into main Aug 30, 2025
10 checks passed
@stklcode stklcode deleted the fix/mapof branch August 30, 2025 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants