Fixed poking segfault
Machine would segfault when poking address 0 on an uninitialized block. this has been fixed.
This commit is contained in:
parent
635aced0d4
commit
e342d9b254
@ -263,7 +263,7 @@ func (machine *Machine[WORD]) Peek(address WORD) (word WORD) {
|
||||
// Poke sets the value at address in the block to word.
|
||||
func (machine *Machine[WORD]) Poke(address WORD, word WORD) {
|
||||
if int(address) >= len(machine.block) {
|
||||
reallocatedBlock := make([]WORD, address*3/2)
|
||||
reallocatedBlock := make([]WORD, address*3/2+1)
|
||||
copy(reallocatedBlock, machine.block)
|
||||
machine.block = reallocatedBlock
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user