!4028 Fix of debugInfo extractor

Merge pull request !4028 from lijiamin/fix
This commit is contained in:
openharmony_ci 2023-05-17 02:16:09 +00:00 committed by Gitee
commit 5690bc6524
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -242,11 +242,13 @@ const std::string &DebugInfoExtractor::GetSourceCode(const panda_file::File::Ent
bool DebugInfoExtractor::ExtractorMethodDebugInfo(const panda_file::File::EntityId methodId)
{
auto &pandaFile = *jsPandaFile_->GetPandaFile();
if (!methodId.IsValid() || methodId.GetOffset() > jsPandaFile_->GetFileSize()) {
if (!methodId.IsValid() || methodId.GetOffset() >= jsPandaFile_->GetFileSize()) {
return false;
}
MethodDataAccessor mda(pandaFile, methodId);
ClassDataAccessor cda(pandaFile, mda.GetClassId());
auto classId = mda.GetClassId();
ASSERT(classId.IsValid() && !pandaFile.IsExternal(classId));
ClassDataAccessor cda(pandaFile, classId);
auto sourceFileId = cda.GetSourceFileId();
auto debugInfoId = mda.GetDebugInfoId();
if (!debugInfoId) {