]> Repositorios git - scryer-prolog.git/commitdiff
remove unsafe unwrap in put_char (#1881)
authorMark <[email protected]>
Wed, 12 Jul 2023 20:24:20 +0000 (14:24 -0600)
committerMark <[email protected]>
Wed, 12 Jul 2023 20:24:20 +0000 (14:24 -0600)
src/machine/system_calls.rs

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