diff options
Diffstat (limited to 'src/devices')
-rw-r--r-- | src/devices/system/read_only_text_buffer.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/devices/system/read_only_text_buffer.rs b/src/devices/system/read_only_text_buffer.rs index 7c59025..dae1024 100644 --- a/src/devices/system/read_only_text_buffer.rs +++ b/src/devices/system/read_only_text_buffer.rs @@ -6,15 +6,15 @@ pub struct ReadOnlyTextBuffer { impl ReadOnlyTextBuffer { pub fn from_text(text: &str) -> Self { Self { - chars: text.chars().map(|c| c as u32 as u8).collect(), + chars: text.bytes().collect(), pointer: 0, } } pub fn read_byte(&mut self) -> u8 { - let byte = self.chars[self.pointer]; + let option = self.chars.get(self.pointer); self.pointer += 1; - return byte; + *option.unwrap_or(&0) } pub fn reset_pointer(&mut self) { |