mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 19:58:09 +02:00
rusticl/icd: fix ReferenceCountedAPIPointer::from_ptr for NULL pointers
If a NULL pointer is passed in, we have to return one as well. Signed-off-by: Karol Herbst <git@karolherbst.de> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23573>
This commit is contained in:
parent
e358173fbf
commit
30559a399b
1 changed files with 3 additions and 0 deletions
|
|
@ -308,6 +308,9 @@ macro_rules! impl_cl_type_trait {
|
|||
}
|
||||
|
||||
fn from_ptr(ptr: *const $t) -> Self {
|
||||
if ptr.is_null() {
|
||||
return std::ptr::null_mut();
|
||||
}
|
||||
let offset = ::mesa_rust_util::offset_of!($t, base);
|
||||
// SAFETY: The resulting pointer is safe as we simply offset into the ICD specified
|
||||
// base type.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue