Skip to content

Commit 633aca7

Browse files
authored
Merge pull request #7 from duart38/experimental
added clamp logic to setPixelColor
2 parents ca98ae5 + e3450d3 commit 633aca7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

IDGVM/Machine.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,9 @@ export default class IDGVM {
254254
return this.image.imageData[n]
255255
}
256256
setPixelColor(n: number, value: number){
257-
this.imageCopy[n] = value;
257+
if(n > 0 && n < this.imageCopy.length){
258+
this.imageCopy[n] = value;
259+
}
258260
}
259261

260262
async execute(instruction: number) {

0 commit comments

Comments
 (0)