assistant2: Fix panics when confirming nonexistent entries in the context picker (#22332)
This PR fixes a panic that could occur when confirming when the context picker had no matching entries. Release Notes: - N/A
This commit is contained in:
parent
831930aad0
commit
1449377278
3 changed files with 9 additions and 3 deletions
|
@ -178,7 +178,9 @@ impl PickerDelegate for DirectoryContextPickerDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn confirm(&mut self, _secondary: bool, cx: &mut ViewContext<Picker<Self>>) {
|
fn confirm(&mut self, _secondary: bool, cx: &mut ViewContext<Picker<Self>>) {
|
||||||
let mat = &self.matches[self.selected_index];
|
let Some(mat) = self.matches.get(self.selected_index) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
let workspace = self.workspace.clone();
|
let workspace = self.workspace.clone();
|
||||||
let Some(project) = workspace
|
let Some(project) = workspace
|
||||||
|
|
|
@ -192,7 +192,9 @@ impl PickerDelegate for FileContextPickerDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn confirm(&mut self, _secondary: bool, cx: &mut ViewContext<Picker<Self>>) {
|
fn confirm(&mut self, _secondary: bool, cx: &mut ViewContext<Picker<Self>>) {
|
||||||
let mat = &self.matches[self.selected_index];
|
let Some(mat) = self.matches.get(self.selected_index) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
let workspace = self.workspace.clone();
|
let workspace = self.workspace.clone();
|
||||||
let Some(project) = workspace
|
let Some(project) = workspace
|
||||||
|
|
|
@ -154,7 +154,9 @@ impl PickerDelegate for ThreadContextPickerDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn confirm(&mut self, _secondary: bool, cx: &mut ViewContext<Picker<Self>>) {
|
fn confirm(&mut self, _secondary: bool, cx: &mut ViewContext<Picker<Self>>) {
|
||||||
let entry = &self.matches[self.selected_index];
|
let Some(entry) = self.matches.get(self.selected_index) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
let Some(thread_store) = self.thread_store.upgrade() else {
|
let Some(thread_store) = self.thread_store.upgrade() else {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue