Skip to content

Commit

Permalink
fix(ios): turbo module type convert nullptr crash
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwcg committed Jul 19, 2024
1 parent b07a29d commit cc57375
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
3 changes: 0 additions & 3 deletions core/src/napi/jsc/jsc_ctx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,6 @@ std::shared_ptr<CtxValue> JSCCtx::CreateObject(const std::unordered_map<std::sha
std::shared_ptr<CtxValue> JSCCtx::CreateArray(
size_t count,
std::shared_ptr<CtxValue> array[]) {
if (count <= 0) {
return nullptr;
}

JSValueRef values[count]; // NOLINT(runtime/arrays)
for (size_t i = 0; i < count; i++) {
Expand Down
2 changes: 1 addition & 1 deletion ios/sdk/module/turbo/HippyOCTurboModule.mm
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ - (id)invokeObjCMethodWithName:(NSString *)methodName
std::shared_ptr<napi::CtxValue> propRef = convertObjcObjectToCtxValue(jscCtx, propValue, module);
std::shared_ptr<JSCCtxValue> ctx_value =
std::static_pointer_cast<JSCCtxValue>(propRef);
JSValueRef valueRef = ctx_value->value_;
JSValueRef valueRef = ctx_value ? ctx_value->value_ : nullptr;

JSStringRef propName = JSStringCreateWithCFString((__bridge CFStringRef)propertyName);
JSValueRef jsError = NULL;
Expand Down

0 comments on commit cc57375

Please sign in to comment.