IssueNo:#I5R1HG

Description: 修复不解压工具类初始化空指针问题
Sig:SIG_ApplicationFramework
Feature or Bugfix:Bugfix
Binary Source: No

Signed-off-by: dy_study <dingyao5@huawei.com>
Change-Id: I609ba4ffbaa9106b7dd70c43952324052ce2df37
This commit is contained in:
dy_study
2022-09-14 15:55:31 +08:00
parent 6dcebf58dd
commit cbcb6adeb5
2 changed files with 11 additions and 2 deletions
+9
View File
@@ -121,6 +121,9 @@ public:
std::shared_ptr<RuntimeExtractor> runtimeExtractor;
if (runtimeExtractorMap_.find(hapPath) == runtimeExtractorMap_.end()) {
runtimeExtractor = RuntimeExtractor::Create(hapPath);
if (runtimeExtractor == nullptr) {
return result;
}
runtimeExtractor->SetRuntimeFlag(true);
runtimeExtractorMap_.insert(make_pair(hapPath, runtimeExtractor));
} else {
@@ -261,6 +264,9 @@ private:
bundleName_ = options.bundleName;
panda::JSNApi::SetHostResolvePathTracker(vm_, JsModuleSearcher(options.bundleName));
std::shared_ptr<RuntimeExtractor> runtimeExtractor = RuntimeExtractor::Create(options.hapPath);
if (runtimeExtractor == nullptr) {
return false;
}
runtimeExtractor->SetRuntimeFlag(true);
runtimeExtractorMap_.insert(make_pair(options.hapPath, runtimeExtractor));
panda::JSNApi::SetHostResolveBufferTracker(
@@ -615,6 +621,9 @@ bool JsRuntime::RunScript(const std::string& srcPath, const std::string& hapPath
std::shared_ptr<RuntimeExtractor> runtimeExtractor;
if (runtimeExtractorMap_.find(hapPath) == runtimeExtractorMap_.end()) {
runtimeExtractor = RuntimeExtractor::Create(hapPath);
if (runtimeExtractor == nullptr) {
return result;
}
runtimeExtractor->SetRuntimeFlag(true);
runtimeExtractorMap_.insert(make_pair(hapPath, runtimeExtractor));
} else {
@@ -49,7 +49,7 @@ std::shared_ptr<RuntimeExtractor> RuntimeExtractor::Create(const std::string& ha
{
if (hapPath.empty()) {
HILOG_ERROR("source is nullptr");
return std::shared_ptr<RuntimeExtractor>();
return nullptr;
}
std::string loadPath;
@@ -61,7 +61,7 @@ std::shared_ptr<RuntimeExtractor> RuntimeExtractor::Create(const std::string& ha
std::shared_ptr<RuntimeExtractor> runtimeExtractor = std::make_shared<RuntimeExtractor>(loadPath);
if (!runtimeExtractor->Init()) {
HILOG_ERROR("RuntimeExtractor create failed");
return std::shared_ptr<RuntimeExtractor>();
return nullptr;
}
return runtimeExtractor;