Skip to content

Commit

Permalink
fix(segmented_button): model index out of bounds when setting position
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony4dev authored Dec 3, 2024
1 parent b80d90e commit d536341
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/widget/segmented_button/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,10 @@ where
return None;
};

self.order.remove(index as usize);

let position = self.order.len().min(position as usize);

self.order.remove(index as usize);
self.order.insert(position, id);
Some(position)
}
Expand Down

0 comments on commit d536341

Please sign in to comment.