Avoid panicking when closing a dragged tab
Co-Authored-By: Max <max@zed.dev> Co-Authored-By: Nathan <nathan@zed.dev>
This commit is contained in:
parent
a56265e607
commit
e60117dc54
2 changed files with 10 additions and 12 deletions
|
@ -2250,17 +2250,16 @@ impl Workspace {
|
|||
destination_index: usize,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) {
|
||||
let item_to_move = source
|
||||
let Some((item_ix, item_handle)) = source
|
||||
.read(cx)
|
||||
.items()
|
||||
.enumerate()
|
||||
.find(|(_, item_handle)| item_handle.item_id() == item_id_to_move);
|
||||
|
||||
if item_to_move.is_none() {
|
||||
log::warn!("Tried to move item handle which was not in `from` pane. Maybe tab was closed during drop");
|
||||
.find(|(_, item_handle)| item_handle.item_id() == item_id_to_move)
|
||||
else {
|
||||
// Tab was closed during drag
|
||||
return;
|
||||
}
|
||||
let (item_ix, item_handle) = item_to_move.unwrap();
|
||||
};
|
||||
|
||||
let item_handle = item_handle.clone();
|
||||
|
||||
if source != destination {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue