增加判空

Signed-off-by: fangting <fangting12@huawei.com>
This commit is contained in:
fangting 2024-11-05 10:23:57 +08:00
parent 5ea5b99b21
commit fab55af3ac

View File

@ -736,7 +736,12 @@ bool JsRuntime::Initialize(const Options& options)
std::string loadPath = ExtractorUtil::GetLoadFilePath(options.hapPath);
bool newCreate = false;
std::shared_ptr<Extractor> extractor = ExtractorUtil::GetExtractor(loadPath, newCreate);
bool hasFile = extractor->HasEntry(MERGE_SOURCE_MAP_PATH);
bool hasFile = false;
if (!extractor) {
TAG_LOGD(AAFwkTag::JSRUNTIME, "Get extractor failed. hapPath[%{private}s]", loadPath.c_str());
} else {
hasFile = extractor->HasEntry(MERGE_SOURCE_MAP_PATH);
}
auto operatorObj = std::make_shared<JsEnv::SourceMapOperator>(options.bundleName, isModular,
hasFile);
InitSourceMap(operatorObj);