From fd6bb1a2e6ded1d32995f98bb5014cd1287f9fc0 Mon Sep 17 00:00:00 2001 From: luomy Date: Fri, 24 Sep 2021 12:40:20 +0800 Subject: [PATCH] fix(ios): fix a potential crash due to null pointer (#985) --- ios/sdk/base/executors/HippyJSCExecutor.mm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ios/sdk/base/executors/HippyJSCExecutor.mm b/ios/sdk/base/executors/HippyJSCExecutor.mm index fc898526a..5ccb62161 100644 --- a/ios/sdk/base/executors/HippyJSCExecutor.mm +++ b/ios/sdk/base/executors/HippyJSCExecutor.mm @@ -422,6 +422,10 @@ HIPPY_EXPORT_METHOD(setContextName:(NSString *)contextName) { - (void)secondBundleLoadCompleted:(BOOL)success { std::shared_ptr context = std::static_pointer_cast(self.pScope->GetContext()); + HippyAssert(context != nullptr, @"secondBundleLoadCompleted get null context"); + if (nullptr == context) { + return; + } NSString *workFolder = [self.bridge workFolder2]; HippyAssert(workFolder, @"work folder path should not be null"); if (workFolder) {