diff options
-rw-r--r-- | fxjs/cjs_globalarrays.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fxjs/cjs_globalarrays.cpp b/fxjs/cjs_globalarrays.cpp index a697c18ac6..9cf540e418 100644 --- a/fxjs/cjs_globalarrays.cpp +++ b/fxjs/cjs_globalarrays.cpp @@ -8,10 +8,11 @@ #define GLOBAL_ARRAY(rt, name, ...) \ { \ - const wchar_t* values[] = {__VA_ARGS__}; \ + static const wchar_t* const values[] = {__VA_ARGS__}; \ v8::Local<v8::Array> array = (rt)->NewArray(); \ + v8::Local<v8::Context> ctx = (rt)->GetIsolate()->GetCurrentContext(); \ for (size_t i = 0; i < FX_ArraySize(values); ++i) \ - array->Set(i, (rt)->NewString(values[i])); \ + array->Set(ctx, i, (rt)->NewString(values[i])).FromJust(); \ (rt)->SetConstArray((name), array); \ (rt)->DefineGlobalConst( \ (name), [](const v8::FunctionCallbackInfo<v8::Value>& info) { \ |