1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-03-25 04:25:42 +00:00

fix(core/rust): increase capacity of debug error message

slicing the str like before is wrong because we may just happen to hit
in the middle of an utf8 sequence, which will cause a silent panic.
this way we at least get a visible panic: either "Text too long: <full
text>", or "unwrap failed" if the text doesn't fit into the 128-byte
string instance
This commit is contained in:
matejcik 2025-02-17 14:01:13 +01:00 committed by matejcik
parent 68d979a513
commit 61a3382abd

View File

@ -107,7 +107,7 @@ pub fn split_two_lines(text: &str, text_font: Font, available_width: i16) -> (&s
#[cfg(feature = "ui_debug")]
if text_font.text_width(second_line) > available_width {
fatal_error!(&uformat!("Text too long: {}...!", &text[..15]));
fatal_error!(&uformat!(len: 128, "Text too long: '{}'", text));
}
(first_line, second_line)