Skip to content

Commit 58ad42c

Browse files
Minor refactoring CScriptRuntimeInfo.h
1 parent e13f8ab commit 58ad42c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

module/src/CScriptRuntimeInfo.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ class CScriptRuntimeInfo
1717

1818
public:
1919
v8::Isolate* GetIsolate() {
20-
if (!isolates.Find(std::this_thread::get_id()))
20+
auto isolate = isolates.GetElement(std::this_thread::get_id());
21+
if (!isolate)
2122
{
22-
Log::Colored << "NOT FOUND" << std::this_thread::get_id() << Log::Endl;
23-
v8::Isolate* isolate = MakeIsolate();
24-
isolates.Insert(std::this_thread::get_id(), isolate);
25-
return isolate;
23+
v8::Isolate* newIsolate = MakeIsolate();
24+
isolates.Insert(std::this_thread::get_id(), newIsolate);
25+
return newIsolate;
2626
}
27-
return isolates.GetElement(std::this_thread::get_id()).value_or(nullptr);
27+
return *isolate;
2828
}
2929

3030
v8::Isolate* MakeIsolate()

0 commit comments

Comments
 (0)