From b5fc3a83614dc7c668ec47503f26d4eae6e8545b Mon Sep 17 00:00:00 2001 From: Martin Milata Date: Tue, 27 May 2025 15:00:28 +0200 Subject: [PATCH] fix(core): panic in Map::try_clone [no changelog] --- core/embed/rust/src/micropython/map.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/embed/rust/src/micropython/map.rs b/core/embed/rust/src/micropython/map.rs index 51789abd4f..0b0b71a939 100644 --- a/core/embed/rust/src/micropython/map.rs +++ b/core/embed/rust/src/micropython/map.rs @@ -164,8 +164,10 @@ impl Map { impl Map { pub fn try_clone(&self) -> Result { 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());