Fix pos check

Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/IASP13?from=project-issue

Signed-off-by: yaochaonan <yaochaonan@huawei.com>
Change-Id: I9322aedf68eaf47ec85cbfd4d121bd9561e7cb19
This commit is contained in:
yaochaonan 2024-09-21 15:32:17 +08:00
parent 93e71f0160
commit c8369d38a5

View File

@ -791,6 +791,9 @@ CString ModulePathHelper::TranslateExpressionInputWithEts(JSThread *thread, cons
void ModulePathHelper::ParseCrossModuleFile(const JSPandaFile *jsPandaFile, CString &requestPath)
{
size_t pos = requestPath.find(PathHelper::SLASH_TAG);
if (pos == CString::npos) {
return;
}
CString moduleName = requestPath.substr(0, pos);
CString outEntryPoint;
// try get mapped module path by single level moduleName.
@ -798,6 +801,9 @@ void ModulePathHelper::ParseCrossModuleFile(const JSPandaFile *jsPandaFile, CStr
if (!isModuleName) {
// retry get mapped module path by two level moduleName
pos = requestPath.find(PathHelper::SLASH_TAG, pos + 1);
if (pos == CString::npos) {
return;
}
moduleName = requestPath.substr(0, pos);
isModuleName = jsPandaFile->FindOhmUrlInPF(moduleName, outEntryPoint);
}