From 58ad42c05a49e5af02f0e082db7212f010838bc7 Mon Sep 17 00:00:00 2001 From: libragliese581 Date: Fri, 10 Jan 2025 16:22:13 +0300 Subject: [PATCH] Minor refactoring CScriptRuntimeInfo.h --- module/src/CScriptRuntimeInfo.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/module/src/CScriptRuntimeInfo.h b/module/src/CScriptRuntimeInfo.h index 0547837..afc2172 100644 --- a/module/src/CScriptRuntimeInfo.h +++ b/module/src/CScriptRuntimeInfo.h @@ -17,14 +17,14 @@ class CScriptRuntimeInfo public: v8::Isolate* GetIsolate() { - if (!isolates.Find(std::this_thread::get_id())) + auto isolate = isolates.GetElement(std::this_thread::get_id()); + if (!isolate) { - Log::Colored << "NOT FOUND" << std::this_thread::get_id() << Log::Endl; - v8::Isolate* isolate = MakeIsolate(); - isolates.Insert(std::this_thread::get_id(), isolate); - return isolate; + v8::Isolate* newIsolate = MakeIsolate(); + isolates.Insert(std::this_thread::get_id(), newIsolate); + return newIsolate; } - return isolates.GetElement(std::this_thread::get_id()).value_or(nullptr); + return *isolate; } v8::Isolate* MakeIsolate()