File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -109,21 +109,33 @@ impl<'a> NodeTable<'a> {
109
109
}
110
110
111
111
/// Mutable access to node flags.
112
+ ///
113
+ /// # Note
114
+ ///
115
+ /// Internally, we rely on a conversion of u64 to usize.
116
+ /// This conversion is fallible on some platforms.
117
+ /// If the conversion fails, an empty slice is returned.
112
118
pub fn flags_array_mut ( & mut self ) -> & mut [ NodeFlags ] {
113
119
unsafe {
114
120
std:: slice:: from_raw_parts_mut (
115
121
self . table_ . flags . cast :: < NodeFlags > ( ) ,
116
- usize:: try_from ( self . table_ . num_rows ) . unwrap ( ) ,
122
+ usize:: try_from ( self . table_ . num_rows ) . unwrap_or ( 0 ) ,
117
123
)
118
124
}
119
125
}
120
126
121
127
/// Mutable access to node times.
128
+ ///
129
+ /// # Note
130
+ ///
131
+ /// Internally, we rely on a conversion of u64 to usize.
132
+ /// This conversion is fallible on some platforms.
133
+ /// If the conversion fails, an empty slice is returned.
122
134
pub fn time_array_mut ( & mut self ) -> & mut [ Time ] {
123
135
unsafe {
124
136
std:: slice:: from_raw_parts_mut (
125
137
self . table_ . time . cast :: < Time > ( ) ,
126
- usize:: try_from ( self . table_ . num_rows ) . unwrap ( ) ,
138
+ usize:: try_from ( self . table_ . num_rows ) . unwrap_or ( 0 ) ,
127
139
)
128
140
}
129
141
}
You can’t perform that action at this time.
0 commit comments