Add checks to AssetBuffers before they are used (#820)

* add checks to buffers before they are used
to avoid crashing

* address feedback
This commit is contained in:
Aaron Kimbrell
2022-11-10 12:59:31 -06:00
committed by GitHub
parent 7c2437173b
commit 1eff3ae454
4 changed files with 26 additions and 1 deletions

View File

@@ -344,6 +344,11 @@ void Item::DisassembleModel() {
std::string lxfmlPath = "BrickModels/" + GeneralUtils::SplitString(renderAssetSplit.back(), '.').at(0) + ".lxfml";
auto buffer = Game::assetManager->GetFileAsBuffer(lxfmlPath.c_str());
if (!buffer.m_Success) {
Game::logger->Log("Item", "Failed to load %s to disassemble model into bricks, check that this file exists", lxfmlPath.c_str());
return;
}
std::istream file(&buffer);
result.finalize();