Skip to content

Commit 62286eb

Browse files
committed
reading non'existing files from archives doesn't crash
1 parent ccdb7c9 commit 62286eb

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

include/nbl/system/IFileArchive.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ class IFileArchive : public core::IReferenceCounted
135135
core::smart_refctd_ptr<IFile> readFile(const SOpenFileParams& params)
136136
{
137137
auto index = getIndexByPath(params.filename);
138+
if (index == -1) return nullptr;
138139
switch (this->getFileType(index))
139140
{
140141
case EAT_NULL:

include/nbl/system/ISystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class ISystem : public core::IReferenceCounted
181181
auto& params = std::get<IFileArchive::SOpenFileParams>(found);
182182
// TODO: support passwords
183183
auto f = archive->readFile(params);
184-
assert(f.get()); // cannot fail
184+
//assert(f.get()); // cannot fail
185185
return f;
186186
}
187187

0 commit comments

Comments
 (0)