diff --git a/source/scriptinterface/ScriptInterface.cpp b/source/scriptinterface/ScriptInterface.cpp index babca761df..53621fe7b3 100644 --- a/source/scriptinterface/ScriptInterface.cpp +++ b/source/scriptinterface/ScriptInterface.cpp @@ -792,6 +792,8 @@ bool ScriptInterface::LoadScript(const VfsPath& filename, const std::wstring& co bool ScriptInterface::LoadGlobalScriptFile(const VfsPath& path) { + debug_assert(ThreadUtil::IsMainThread()); // VFS isn't thread-safe + if (!VfsFileExists(g_VFS, path)) { LOGERROR(L"File '%ls' does not exist", path.string().c_str()); @@ -878,6 +880,8 @@ CScriptValRooted ScriptInterface::ParseJSON(const std::string& string_utf8) CScriptValRooted ScriptInterface::ReadJSONFile(const VfsPath& path) { + debug_assert(ThreadUtil::IsMainThread()); // VFS isn't thread-safe + if (!VfsFileExists(g_VFS, path)) { LOGERROR(L"File '%ls' does not exist", path.string().c_str());