Przeglądaj źródła

Check for NaN before applying styles

tk338g 4 lat temu
rodzic
commit
93d0a56bdb
1 zmienionych plików z 9 dodań i 0 usunięć
  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={{