mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-06-18 05:58:45 +00:00
fix(core): panic in Map::try_clone
[no changelog]
This commit is contained in:
parent
9285b73e47
commit
b5fc3a8361
@ -164,9 +164,11 @@ impl Map {
|
|||||||
impl Map {
|
impl Map {
|
||||||
pub fn try_clone(&self) -> Result<Self, Error> {
|
pub fn try_clone(&self) -> Result<Self, Error> {
|
||||||
let mut map = Self::with_capacity(self.len())?;
|
let mut map = Self::with_capacity(self.len())?;
|
||||||
|
if !self.table.is_null() {
|
||||||
unsafe {
|
unsafe {
|
||||||
ptr::copy_nonoverlapping(self.table, map.table, self.len());
|
ptr::copy_nonoverlapping(self.table, map.table, self.len());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
map.set_used(self.used());
|
map.set_used(self.used());
|
||||||
map.set_all_keys_are_qstrs(self.all_keys_are_qstrs());
|
map.set_all_keys_are_qstrs(self.all_keys_are_qstrs());
|
||||||
map.set_is_ordered(self.is_ordered());
|
map.set_is_ordered(self.is_ordered());
|
||||||
|
Loading…
Reference in New Issue
Block a user