From 8030a3264a7a7fa8c5797932cf79a260ba5e8992 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 2 Feb 2023 21:04:50 +0100 Subject: [PATCH] Update MemoryIOWrapper.h --- include/assimp/MemoryIOWrapper.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/assimp/MemoryIOWrapper.h b/include/assimp/MemoryIOWrapper.h index fce683773..87b28ac91 100644 --- a/include/assimp/MemoryIOWrapper.h +++ b/include/assimp/MemoryIOWrapper.h @@ -175,18 +175,22 @@ public: // ------------------------------------------------------------------- /** Returns the directory separator. */ char getOsSeparator() const override { - return existing_io ? existing_io->getOsSeparator() - : '/'; // why not? it doesn't care + return existing_io ? existing_io->getOsSeparator() : '/'; } // ------------------------------------------------------------------- - /** Open a new file with a given path. */ + /// Open a new file with a given path. IOStream* Open(const char* pFile, const char* pMode = "rb") override { + if (pFile == nullptr) { + return nullptr; + } + if ( 0 == strncmp( pFile, AI_MEMORYIO_MAGIC_FILENAME, AI_MEMORYIO_MAGIC_FILENAME_LENGTH ) ) { created_streams.emplace_back(new MemoryIOStream(buffer, length)); return created_streams.back(); } - return existing_io ? existing_io->Open(pFile, pMode) : NULL; + + return existing_io ? existing_io->Open(pFile, pMode) : nullptr; } // -------------------------------------------------------------------