Fixed crash when prefab file doesnt exist in trenchbroom map

This commit is contained in:
Antoine Pilote
2023-07-02 16:33:26 -04:00
parent abc93cf799
commit 718e7c6997

View File

@@ -16,8 +16,11 @@ namespace Nuake {
Ref<Prefab> newPrefab = CreateRef<Prefab>();
newPrefab->Path = path;
std::string prefabTextContent = FileSystem::ReadFile(path);
newPrefab->Deserialize(prefabTextContent);
if (FileSystem::FileExists(path, false))
{
std::string prefabTextContent = FileSystem::ReadFile(path);
newPrefab->Deserialize(prefabTextContent);
}
return newPrefab;
}