mirror of
https://github.com/izzy2lost/libultraship.git
synced 2026-06-19 01:16:13 -07:00
Add check to LoadFile to check for fileToLoad == nullptr before calling ReadResourceInitDataLegacy to prevent crashes from trying to assign to a null container with files of 0 size. (#802)
This commit is contained in:
@@ -218,6 +218,10 @@ std::shared_ptr<File> Archive::LoadFile(const std::string& filePath, std::shared
|
||||
fileToLoad->InitData = initDataFromMetaFile;
|
||||
} else {
|
||||
fileToLoad = LoadFileRaw(filePath);
|
||||
if (fileToLoad == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load file at path {}.", filePath);
|
||||
return nullptr;
|
||||
}
|
||||
fileToLoad->InitData = ReadResourceInitDataLegacy(filePath, fileToLoad);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user