File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,25 +102,33 @@ bool SceneFile::Deserialise(std::vector<Entity*>& entities)
102102 };
103103
104104 // TODO: Implement proper write-mode handling for scene system
105+ String ScenePath = MakeScenePath (sceneName);
105106 if (!SceneSystem::GetBaseDirectory ().IsEmpty ())
106107 {
107108 bool result = FileSystem::ForEachFileInDir (
108- MakeScenePath (sceneName) ,
109+ ScenePath ,
109110 [&deserialiseEntityString](const std::filesystem::path& path) {
110111 if (path.extension () != ENTITY_FILE_EXT) return ;
111112 String entityData = FileSystem::Read (path.c_str ());
112113 deserialiseEntityString (entityData, path);
113114 });
114115 if (!result)
115116 {
116- CC_LOG_ERROR (" Failed to read scene file at path \" {}\" " , MakeScenePath (sceneName) )
117+ CC_LOG_ERROR (" Failed to read scene file at path \" {}\" " , ScenePath )
117118 return false ;
118119 }
119120 }
120121 else
121122 {
122123 PackFile* packFile = ResourceSystem::GetInstance ().GetPackFile ();
123- SceneData* sceneData = packFile->FindData <SceneData>(MakeScenePath (sceneName));
124+
125+ SceneData* sceneData = packFile->FindData <SceneData>(ScenePath);
126+ if (!sceneData)
127+ {
128+ CC_LOG_WARNING (" Failed to find scene \" {}\" in pack file" , ScenePath)
129+ return false ;
130+ }
131+
124132 String sceneString (sceneData->data );
125133 for (const String& entityData : sceneString.Split (' |' ))
126134 {
You can’t perform that action at this time.
0 commit comments