From 718e7c699707867b3015460aca9b50dbffb1fec0 Mon Sep 17 00:00:00 2001 From: Antoine Pilote Date: Sun, 2 Jul 2023 16:33:26 -0400 Subject: [PATCH] Fixed crash when prefab file doesnt exist in trenchbroom map --- Nuake/src/Resource/Prefab.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Nuake/src/Resource/Prefab.cpp b/Nuake/src/Resource/Prefab.cpp index 9932d3c6..66e89aef 100644 --- a/Nuake/src/Resource/Prefab.cpp +++ b/Nuake/src/Resource/Prefab.cpp @@ -16,8 +16,11 @@ namespace Nuake { Ref newPrefab = CreateRef(); 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; }