소스 검색

Check for NaN before applying styles

tk338g 4 년 전
부모
커밋
93d0a56bdb
1개의 변경된 파일9개의 추가작업 그리고 0개의 파일을 삭제
  1. 9 0
      src/components/MiniMap.tsx

+ 9 - 0
src/components/MiniMap.tsx

@@ -58,6 +58,15 @@ const MinimapViewport = ({
     height + top,
   );
 
+  if (
+    Number.isNaN(viewportTop) ||
+    Number.isNaN(viewportLeft) ||
+    Number.isNaN(viewportWidth) ||
+    Number.isNaN(viewportHeight)
+  ) {
+    return null;
+  }
+
   return (
     <div
       style={{