From aa929a14cf30d16c43a676813ecd2dff07b42864 Mon Sep 17 00:00:00 2001 From: etkmao Date: Mon, 6 Jan 2025 16:46:47 +0800 Subject: [PATCH] fix(core): try fix ios hash throw overflow crash (#4166) --- driver/js/src/napi/jsc/jsc_ctx.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/driver/js/src/napi/jsc/jsc_ctx.cc b/driver/js/src/napi/jsc/jsc_ctx.cc index 6e391e512bc..5297a0202e9 100644 --- a/driver/js/src/napi/jsc/jsc_ctx.cc +++ b/driver/js/src/napi/jsc/jsc_ctx.cc @@ -98,8 +98,12 @@ JSValueRef InvokeJsCallback(JSContextRef ctx, auto object_private_data = JSObjectGetPrivate(object); if (object_private_data) { auto constructor_data = reinterpret_cast(object_private_data); - auto object_data = constructor_data->object_data_map[object]; - cb_info.SetData(object_data); + auto it = constructor_data->object_data_map.find(object); + if (it != constructor_data->object_data_map.end()) { + cb_info.SetData(it->second); + } else { + cb_info.SetData(nullptr); + } } } for (size_t i = 0; i < argument_count; i++) {