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

Check for null object IDs #12

Merged
merged 1 commit into from
Jan 11, 2024
Merged

Check for null object IDs #12

merged 1 commit into from
Jan 11, 2024

Conversation

alexjg
Copy link
Collaborator

@alexjg alexjg commented Jan 11, 2024

Problem: at various places in the rust codebase we receive an object ID from the java side in the form of a jobject which is a pointer to a ObjectId. This pointer can be null but we were not checking whether it was null and consequently were panicking and crashing the entire JVM.

Solution: check for null when loading object IDs and throw an IllegalArgumentException if the ObjectId is null. This required a macro to avoid lots of code handling the early return.

Fixes #4 (I think)

Problem: at various places in the rust codebase we receive an object ID
from the java side in the form of a `jobject` which is a pointer to a
`ObjectId`. This pointer can be null but we were not checking whether it
was null and consequently were panicking and crashing the entire JVM.

Solution: check for null when loading object IDs and throw an
IllegalArgumentException if the `ObjectId` is null. This required a
macro to avoid lots of code handling the early return.
@alexjg alexjg merged commit c70bdd6 into main Jan 11, 2024
1 check 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.

Result::unwrap() on an `Err
1 participant