Skip to content

Commit

Permalink
!B (CrySystem) (CE-13632) Fix crash on start-up if .cryproject file d…
Browse files Browse the repository at this point in the history
…id not exist

Copied from Perforce
 Change: 1547467
  • Loading branch information
Cry-59 committed Aug 25, 2017
1 parent 5642ed7 commit b04c5ad
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Code/CryEngine/CrySystem/ProjectManager/ProjectManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,14 @@ bool CProjectManager::ParseProjectFile()
CCryFile file;
file.Open(m_project.filePath.c_str(), "rb", ICryPak::FOPEN_ONDISK);
std::vector<char> projectFileJson;
projectFileJson.resize(file.GetLength());

if (file.ReadRaw(projectFileJson.data(), projectFileJson.size()) == projectFileJson.size() && gEnv->pSystem->GetArchiveHost()->LoadJsonBuffer(Serialization::SStruct(m_project), projectFileJson.data(), projectFileJson.size()))
if (file.GetHandle() != nullptr)
{
projectFileJson.resize(file.GetLength());
}

if (projectFileJson.size() > 0 &&
file.ReadRaw(projectFileJson.data(), projectFileJson.size()) == projectFileJson.size() &&
gEnv->pSystem->GetArchiveHost()->LoadJsonBuffer(Serialization::SStruct(m_project), projectFileJson.data(), projectFileJson.size()))
{
if (m_project.version > LatestProjectFileVersion)
{
Expand Down

0 comments on commit b04c5ad

Please sign in to comment.