浏览代码

Check if the location object exists before using it

Ryan Tremblay 4 年之前
父节点
当前提交
cefc67251e
共有 1 个文件被更改,包括 1 次插入1 次删除
  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:";
     }
 }