Wrap the FileStream creation in try-catch. (#5840)

This commit is contained in:
Tomas Dittmann 2017-07-13 19:56:33 +02:00 committed by Ted John
parent fb10a1460d
commit c1b8230eef
1 changed files with 16 additions and 3 deletions

View File

@ -154,11 +154,24 @@ extern "C"
String::Set(absolutePath, sizeof(absolutePath), seq->Path); String::Set(absolutePath, sizeof(absolutePath), seq->Path);
Path::Append(absolutePath, sizeof(absolutePath), filename); Path::Append(absolutePath, sizeof(absolutePath), filename);
FileStream* fileStream = nullptr;
try
{
fileStream = new FileStream(absolutePath, FILE_MODE_OPEN);
}
catch (const IOException& exception)
{
Console::Error::WriteLine(exception.GetMessage());
}
if (fileStream != nullptr)
{
handle = Memory::Allocate<TitleSequenceParkHandle>(); handle = Memory::Allocate<TitleSequenceParkHandle>();
handle->Stream = new FileStream(absolutePath, FILE_MODE_OPEN); handle->Stream = fileStream;
handle->HintPath = String::Duplicate(filename); handle->HintPath = String::Duplicate(filename);
} }
} }
}
return handle; return handle;
} }