Selaa lähdekoodia

Update dlc.js

Lutz Roeder 3 vuotta sitten
vanhempi
sitoutus
02a715ce74
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 2 2
      source/dlc.js

+ 2 - 2
source/dlc.js

@@ -515,7 +515,7 @@ dlc.Container = class {
             const reader = flatbuffers.BinaryReader.open(buffer);
             return reader.identifier;
         }
-        else if (stream.length > 8) {
+        else if (stream && stream.length > 8) {
             const buffer = stream.peek(8);
             const reader = flatbuffers.BinaryReader.open(buffer);
             return reader.identifier;
@@ -524,7 +524,7 @@ dlc.Container = class {
     }
 
     static _signature(stream, signature) {
-        return stream.length > 16 && stream.peek(signature.length).every((value, index) => value === signature[index]);
+        return stream && stream.length > 16 && stream.peek(signature.length).every((value, index) => value === signature[index]);
     }
 };