Skip to content

Commit

Permalink
Fix error when no input is given
Browse files Browse the repository at this point in the history
  • Loading branch information
Sellig6792 committed Jan 2, 2023
1 parent 22059f1 commit 03800f3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/evaluation/evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,14 @@ impl<T: InstructionTrait<T> + 'static> Evaluator<T>
// Convert the input to a vector of u8
self.input = input.trim().bytes().collect();
}
self.scopes
.get_current_cell_mut()
.set_value(self.input.remove(0));

if self.input.is_empty() {
self.scopes.get_current_cell_mut().set_value(0);
} else {
self.scopes
.get_current_cell_mut()
.set_value(self.input.remove(0));
}
}
}
InstructionType::Output => {
Expand Down

0 comments on commit 03800f3

Please sign in to comment.