]> Repositorios git - scryer-prolog.git/commitdiff
fix peek_byte/2 crash (#1882)
authorMark <[email protected]>
Wed, 12 Jul 2023 22:34:11 +0000 (16:34 -0600)
committerMark <[email protected]>
Wed, 12 Jul 2023 22:34:11 +0000 (16:34 -0600)
src/machine/system_calls.rs

index 532fb1e35bf0a626b18cf12cff7210f8ea5ca94d..7045eff0f63e312dfc22f28dc695b2fae63ffcb1 100644 (file)
@@ -2447,7 +2447,7 @@ impl Machine {
             return Ok(());
         }
 
-         match addr {
+        let addr = match addr {
             addr if addr.is_var() => addr,
             addr => match Number::try_from(addr) {
                 Ok(Number::Integer(n)) => {
@@ -2477,6 +2477,7 @@ impl Machine {
             match stream.peek_byte().map_err(|e| e.kind()) {
                 Ok(b) => {
                     self.machine_st.unify_fixnum(Fixnum::build_with(b as i64), addr);
+                    break;
                 }
                 Err(ErrorKind::PermissionDenied) => {
                     self.machine_st.fail = true;