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

Handle null pointers returned from map_read() #158

Merged
merged 2 commits into from
Jan 10, 2024

Conversation

aliddell
Copy link
Member

Fix for the error Micah ran into the other day.

@aliddell aliddell requested review from nclack and andy-sweet January 10, 2024 18:56
Copy link
Member

@nclack nclack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Left one comment that you can take or leave.

Comment on lines +341 to +345
let nbytes = if beg.is_null() || end.is_null() {
0
} else {
unsafe { byte_offset_from(beg, end) }
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fwiw, there's a rust feature that got stabilized in rust 1.75 that allows us to potentially replace bytes_offet_from with a method in the standard lib (see docs). Similarly for byte_offset.

Those methods don't look like they do any special null handling (playground) so you'd still need this null check.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10-4. I'll add it in.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nclack Actually it looks like the Mac runners are still on 1.74. Windows and Ubuntu updated only yesterday if you look at the blames. I'll add an issue instead.

@aliddell aliddell merged commit dbbaab1 into acquire-project:main Jan 10, 2024
20 checks passed
@aliddell aliddell deleted the handle-null-available-data branch January 10, 2024 22:47
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.

2 participants