Browse Source

Merge pull request #9335 from ryantrem/location-defined-check

Check if the location object exists before using it
David Catuhe 4 năm trước cách đây
mục cha
commit
9f7668d6c7
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  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:";
     }
 }