mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-30 00:34:26 +01:00
Don't crash when failing to decode using StrRef codec
This commit is contained in:
parent
d0109627b9
commit
0ade699873
@ -16,7 +16,7 @@ impl<'a> BytesDecode<'a> for StrRefCodec {
|
|||||||
type DItem = &'a str;
|
type DItem = &'a str;
|
||||||
|
|
||||||
fn bytes_decode(bytes: &'a [u8]) -> Option<Self::DItem> {
|
fn bytes_decode(bytes: &'a [u8]) -> Option<Self::DItem> {
|
||||||
let s = std::str::from_utf8(bytes).unwrap();
|
let s = std::str::from_utf8(bytes).ok()?;
|
||||||
Some(s)
|
Some(s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user