mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-24 00:03:11 +01:00
Wrap the FileStream creation in try-catch. (#5840)
This commit is contained in:
@@ -154,9 +154,22 @@ extern "C"
|
||||
String::Set(absolutePath, sizeof(absolutePath), seq->Path);
|
||||
Path::Append(absolutePath, sizeof(absolutePath), filename);
|
||||
|
||||
handle = Memory::Allocate<TitleSequenceParkHandle>();
|
||||
handle->Stream = new FileStream(absolutePath, FILE_MODE_OPEN);
|
||||
handle->HintPath = String::Duplicate(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->Stream = fileStream;
|
||||
handle->HintPath = String::Duplicate(filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
return handle;
|
||||
|
||||
Reference in New Issue
Block a user