Explorar o código

Merge pull request #3850 from JC3/patch-3

Fix crash in CanRead when file can not be opened.
Kim Kulling %!s(int64=4) %!d(string=hai) anos
pai
achega
226b34bb35
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      code/AssetLib/M3D/M3DImporter.cpp

+ 1 - 1
code/AssetLib/M3D/M3DImporter.cpp

@@ -136,7 +136,7 @@ bool M3DImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool c
         */
         std::unique_ptr<IOStream> pStream(pIOHandler->Open(pFile, "rb"));
         unsigned char data[4];
-        if (4 != pStream->Read(data, 1, 4)) {
+        if (!pStream || 4 != pStream->Read(data, 1, 4)) {
             return false;
         }
         return !memcmp(data, "3DMO", 4) /* bin */