Browse Source

Check for NaN before applying styles

tk338g 4 years ago
parent
commit
93d0a56bdb
1 changed files with 9 additions and 0 deletions
  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={{