mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-28 20:01:33 +00:00
Avoid panic when closing the last tab in a pane, due to calling activate_item
This commit is contained in:
parent
3abd7bc8dd
commit
4f0ffdcdaf
1 changed files with 3 additions and 1 deletions
|
@ -312,7 +312,9 @@ impl Pane {
|
|||
pub fn activate_item(&mut self, index: usize, cx: &mut ViewContext<Self>) {
|
||||
if index < self.item_views.len() {
|
||||
let prev_active_item_ix = mem::replace(&mut self.active_item_index, index);
|
||||
if prev_active_item_ix != self.active_item_index {
|
||||
if prev_active_item_ix != self.active_item_index
|
||||
&& prev_active_item_ix < self.item_views.len()
|
||||
{
|
||||
self.item_views[prev_active_item_ix].1.deactivated(cx);
|
||||
}
|
||||
self.update_active_toolbar(cx);
|
||||
|
|
Loading…
Reference in a new issue