Skip to content

Commit 548124a

Browse files
committed
Only check pixel if zapper has position
1 parent da13c8b commit 548124a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/mappers.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,11 @@ Mappers[0].prototype = {
144144
// https://wiki.nesdev.com/w/index.php/Zapper
145145
var w;
146146

147-
if (this.nes.ppu.isPixelWhite(this.zapperX, this.zapperY)) {
147+
if (
148+
this.zapperX !== null &&
149+
this.zapperY !== null &&
150+
this.nes.ppu.isPixelWhite(this.zapperX, this.zapperY)
151+
) {
148152
w = 0;
149153
} else {
150154
w = 0x1 << 3;

0 commit comments

Comments
 (0)