From 01fe27a77a08c932b6457f1621796a57e6b866d7 Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 23 Jun 2024 21:54:03 -0700 Subject: fix InstructionTextSink panicking in write_char --- src/display/display_sink.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/display/display_sink.rs b/src/display/display_sink.rs index f5ec026..e83f084 100644 --- a/src/display/display_sink.rs +++ b/src/display/display_sink.rs @@ -453,7 +453,9 @@ mod instruction_text_sink { // write single ASCII characters. this is wrong in the general case, but `write_char` // here is not going to be used in the general case. if cfg!(debug_assertions) { - panic!("InstructionTextSink::write_char would truncate output"); + if c > '\x7f' { + panic!("InstructionTextSink::write_char would truncate output"); + } } let to_push = c as u8; // `ptr::write` here because `underlying.add(underlying.len())` may not point to an -- cgit v1.1