mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-25 08:14:20 +00:00
add null-check for empty arrays in debug trampoline (#2490)
This commit is contained in:
parent
b9f1cc3b7c
commit
12c3c9dd26
@ -340,13 +340,29 @@ pub(super) unsafe extern "system" fn trampoline(
|
|||||||
message_id_number,
|
message_id_number,
|
||||||
message: CStr::from_ptr(p_message).to_str().unwrap(),
|
message: CStr::from_ptr(p_message).to_str().unwrap(),
|
||||||
queue_labels: DebugUtilsMessengerCallbackLabelIter(
|
queue_labels: DebugUtilsMessengerCallbackLabelIter(
|
||||||
slice::from_raw_parts(p_queue_labels, queue_label_count as usize).iter(),
|
// Some drivers give a null pointer for empty data.
|
||||||
|
if p_queue_labels.is_null() {
|
||||||
|
&[]
|
||||||
|
} else {
|
||||||
|
slice::from_raw_parts(p_queue_labels, queue_label_count as usize)
|
||||||
|
}
|
||||||
|
.iter(),
|
||||||
),
|
),
|
||||||
cmd_buf_labels: DebugUtilsMessengerCallbackLabelIter(
|
cmd_buf_labels: DebugUtilsMessengerCallbackLabelIter(
|
||||||
slice::from_raw_parts(p_cmd_buf_labels, cmd_buf_label_count as usize).iter(),
|
if p_cmd_buf_labels.is_null() {
|
||||||
|
&[]
|
||||||
|
} else {
|
||||||
|
slice::from_raw_parts(p_cmd_buf_labels, cmd_buf_label_count as usize)
|
||||||
|
}
|
||||||
|
.iter(),
|
||||||
),
|
),
|
||||||
objects: DebugUtilsMessengerCallbackObjectNameInfoIter(
|
objects: DebugUtilsMessengerCallbackObjectNameInfoIter(
|
||||||
slice::from_raw_parts(p_objects, object_count as usize).iter(),
|
if p_objects.is_null() {
|
||||||
|
&[]
|
||||||
|
} else {
|
||||||
|
slice::from_raw_parts(p_objects, object_count as usize)
|
||||||
|
}
|
||||||
|
.iter(),
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user