Skip to content

Commit

Permalink
Added null checking for ctx
Browse files Browse the repository at this point in the history
  • Loading branch information
harshild committed Nov 7, 2024
1 parent 6c81e26 commit 6790360
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/PhotoCollage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ const PhotoCollage = () => {
for (let col = 0; col < cols; col++) {
const x = col * (imageWidthPX + horizontalSpacePX);
const y = row * (imageHeightPX + verticalSpacePX);
ctx.drawImage(uploadedImage, x, y, imageWidthPX, imageHeightPX);
if (ctx) {
ctx.drawImage(uploadedImage, x, y, imageWidthPX, imageHeightPX);
}
}
}
}
Expand Down

0 comments on commit 6790360

Please sign in to comment.