diff --git a/src/app/asm/assembly.rs b/src/app/asm/assembly.rs index f66afc4..3929280 100644 --- a/src/app/asm/assembly.rs +++ b/src/app/asm/assembly.rs @@ -329,7 +329,7 @@ impl App { loop { if current_byte >= maximum_code_byte { - to_byte = maximum_code_byte.saturating_sub(1); + to_byte = maximum_code_byte; break; } let bytes = &self.data.bytes[current_byte..maximum_code_byte]; @@ -363,7 +363,7 @@ impl App { return; } - let to_instruction = self.assembly_offsets[to_byte]; + let to_instruction = self.assembly_offsets.get(to_byte).cloned().unwrap_or(self.assembly_instructions.len()); let mut original_instruction_count = 1; let mut original_instruction_ip = self.assembly_offsets[from_byte]; @@ -396,6 +396,10 @@ impl App { ), ); } + else + { + break; + } } for instruction in instructions.iter() { if let AssemblyLine::Instruction(instruction_tag) = instruction {