diff --git a/src/components/hero-404/index.tsx b/src/components/hero-404/index.tsx index 9f06b2f..0300715 100644 --- a/src/components/hero-404/index.tsx +++ b/src/components/hero-404/index.tsx @@ -218,8 +218,10 @@ void main() { e.preventDefault(); } - const touchX = e.touches[0].clientX; - const touchY = e.touches[0].clientY; + const touch = e.touches[0]; + if (!touch) return; + const touchX = touch.clientX; + const touchY = touch.clientY; const x = (touchX / window.innerWidth) * 2 - 1; const y = (touchY / window.innerHeight) * 2 - 1; diff --git a/src/components/hero/index.tsx b/src/components/hero/index.tsx index 0d75ee3..c114e2d 100644 --- a/src/components/hero/index.tsx +++ b/src/components/hero/index.tsx @@ -227,8 +227,10 @@ void main() { e.preventDefault(); } - const touchX = e.touches[0].clientX; - const touchY = e.touches[0].clientY; + const touch = e.touches[0]; + if (!touch) return; + const touchX = touch.clientX; + const touchY = touch.clientY; const x = (touchX / window.innerWidth) * 2 - 1; const y = (touchY / window.innerHeight) * 2 - 1; diff --git a/tsconfig.json b/tsconfig.json index 93359ad..230f450 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,6 +13,7 @@ "moduleResolution": "bundler", "noUnusedLocals": true, "noUnusedParameters": true, + "noUncheckedIndexedAccess": true, "resolveJsonModule": true, "isolatedModules": true, "jsx": "react-jsx",