1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 19:13:07 +01:00

Apply more code review comments

This commit is contained in:
Ted John
2020-04-22 22:53:32 +01:00
parent d480fb8daa
commit 2f525e0539
11 changed files with 76 additions and 67 deletions

View File

@@ -885,15 +885,19 @@ void ScriptEngine::LoadSharedStorage()
auto path = _env.GetFilePath(PATHID::PLUGIN_STORE);
try
{
auto data = File::ReadAllBytes(path);
auto result = DuktapeTryParseJson(_context, std::string_view((const char*)data.data(), data.size()));
if (result)
if (File::Exists(path))
{
_sharedStorage = std::move(*result);
auto data = File::ReadAllBytes(path);
auto result = DuktapeTryParseJson(_context, std::string_view((const char*)data.data(), data.size()));
if (result)
{
_sharedStorage = std::move(*result);
}
}
}
catch (const std::exception&)
{
fprintf(stderr, "Unable to read '%s'\n", path.c_str());
}
}