From c2d3d22271cb81aacce318df85a1cf8be1ad8122 Mon Sep 17 00:00:00 2001 From: Jason C Date: Sat, 1 May 2021 10:58:29 -0400 Subject: [PATCH] Fix crash in CanRead when file can not be opened. Addresses #3849 --- code/AssetLib/M3D/M3DImporter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/AssetLib/M3D/M3DImporter.cpp b/code/AssetLib/M3D/M3DImporter.cpp index 8cbda23cb..91fa54b75 100644 --- a/code/AssetLib/M3D/M3DImporter.cpp +++ b/code/AssetLib/M3D/M3DImporter.cpp @@ -137,7 +137,7 @@ bool M3DImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool c */ std::unique_ptr 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 */