remove unsafe unwrap in put_char (#1881)

This commit is contained in:
Mark
2023-07-12 14:24:20 -06:00
parent 3f5dbc1680
commit 1791bd8626

View File

@@ -3102,9 +3102,10 @@ impl Machine {
} else { } else {
read_heap_cell!(addr, read_heap_cell!(addr,
(HeapCellValueTag::Atom, (name, _arity)) => { (HeapCellValueTag::Atom, (name, _arity)) => {
let c = name.as_char().unwrap(); if let Some(c) = name.as_char() {
write!(&mut stream, "{}", c).unwrap(); write!(&mut stream, "{}", c).unwrap();
return Ok(()); return Ok(());
}
} }
(HeapCellValueTag::Char, c) => { (HeapCellValueTag::Char, c) => {
write!(&mut stream, "{}", c).unwrap(); write!(&mut stream, "{}", c).unwrap();