File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
crates/bevy_ecs/src/relationship Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -213,15 +213,15 @@ impl OrderedRelationshipSourceCollection for Vec<Entity> {
213
213
214
214
fn place_most_recent ( & mut self , index : usize ) {
215
215
if let Some ( entity) = self . pop ( ) {
216
- let index = index. min ( self . len ( ) - 1 ) ;
216
+ let index = index. min ( self . len ( ) . saturating_sub ( 1 ) ) ;
217
217
self . insert ( index, entity) ;
218
218
}
219
219
}
220
220
221
221
fn place ( & mut self , entity : Entity , index : usize ) {
222
222
if let Some ( current) = <[ Entity ] >:: iter ( self ) . position ( |e| * e == entity) {
223
223
// The len is at least 1, so the subtraction is safe.
224
- let index = index. min ( self . len ( ) - 1 ) ;
224
+ let index = index. min ( self . len ( ) . saturating_sub ( 1 ) ) ;
225
225
Vec :: remove ( self , current) ;
226
226
self . insert ( index, entity) ;
227
227
} ;
You can’t perform that action at this time.
0 commit comments