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