add safety check
This commit is contained in:
parent
86217d121e
commit
dad7fc8fc4
1 changed files with 4 additions and 3 deletions
|
@ -188,11 +188,12 @@ impl ChatDB {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (index, label) in changes {
|
for (index, label) in changes {
|
||||||
vector.remove(index);
|
if index < vector.len() {
|
||||||
vector.splice(index..index, include_db[&label].iter().cloned());
|
vector.remove(index);
|
||||||
|
vector.splice(index..index, include_db[&label].iter().cloned());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_chat_by_id(&self, id: &String) -> Result<usize, String> {
|
pub fn get_chat_by_id(&self, id: &String) -> Result<usize, String> {
|
||||||
|
|
Loading…
Add table
Reference in a new issue