Explorar o código

Check if the location object exists before using it

Ryan Tremblay %!s(int64=4) %!d(string=hai) anos
pai
achega
cefc67251e
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/Misc/fileTools.ts

+ 1 - 1
src/Misc/fileTools.ts

@@ -469,7 +469,7 @@ export class FileTools {
      * @returns boolean
      */
     public static IsFileURL(): boolean {
-        return location.protocol === "file:";
+        return typeof location !== "undefined" && location.protocol === "file:";
     }
 }