2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-05-01 16:09:36 +00:00

chore: add error handling for fastfile bind

This commit is contained in:
Jan Laupetin
2025-10-11 14:42:52 +01:00
parent 2037cf3258
commit 098be53559
4 changed files with 36 additions and 14 deletions
+6 -3
View File
@@ -2,8 +2,11 @@
#include "ZoneLoading.h"
bool FastFileContext::LoadFastFile(const std::string& path)
std::optional<Zone*> FastFileContext::LoadFastFile(const std::string& path)
{
m_loaded_zones.emplace_back(ZoneLoading::LoadZone(path));
return true;
auto zone = ZoneLoading::LoadZone(path);
if (!zone)
return std::nullopt;
return m_loaded_zones.emplace_back(std::move(zone)).get();
}
+2 -1
View File
@@ -2,12 +2,13 @@
#include "Zone/Zone.h"
#include <memory>
#include <optional>
#include <vector>
class FastFileContext
{
public:
bool LoadFastFile(const std::string& path);
std::optional<Zone*> LoadFastFile(const std::string& path);
std::vector<std::unique_ptr<Zone>> m_loaded_zones;
};