mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-21 06:51:01 +01:00
[fontations] slice::from_raw_parts requires the pointer to be non-null
This commit is contained in:
1 parent
aecc9110a3
commit
3ce6b720ac
1 file changed
+5
-1
@@ -776,7 +776,11 @@ pub extern "C" fn hb_fontations_font_set_funcs(font: *mut hb_font_t) {
|
||||
|
||||
let mut num_coords: u32 = 0;
|
||||
let coords = unsafe { hb_font_get_var_coords_normalized(font, &mut num_coords) };
|
||||
let coords = unsafe { std::slice::from_raw_parts(coords, num_coords as usize) };
|
||||
let coords = if coords.is_null() {
|
||||
&[]
|
||||
} else {
|
||||
unsafe { std::slice::from_raw_parts(coords, num_coords as usize) }
|
||||
};
|
||||
let all_zeros = coords.iter().all(|&x| x == 0);
|
||||
// if all zeros, use Location::default()
|
||||
// otherwise, use the provided coords.
|
||||
|
||||
Reference in new issue
Block a user