From 645f2db302134b0b5dcbda967d66b9e8a89b90e3 Mon Sep 17 00:00:00 2001 From: Ishin Pavel Date: Thu, 18 Aug 2022 17:50:36 +0300 Subject: [PATCH] check constant_pool on Undefined Signed-off-by: Ishin Pavel --- runtime/compiler/ecmascript_runtime_interface.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runtime/compiler/ecmascript_runtime_interface.cpp b/runtime/compiler/ecmascript_runtime_interface.cpp index fddc273ab..a732d2c38 100644 --- a/runtime/compiler/ecmascript_runtime_interface.cpp +++ b/runtime/compiler/ecmascript_runtime_interface.cpp @@ -68,6 +68,10 @@ uintptr_t EcmaRuntimeInterface::GetGlobalVarAddress(MethodPtr method, size_t id) auto func = [&](Program *p) { constant_pool = p->GetConstantPool(); }; ecma_vm_->EnumerateProgram(func, panda_file->GetFilename()); + if (constant_pool.IsUndefined()) { + return 0; + } + ASSERT(!constant_pool.IsHole()); JSTaggedValue key = ConstantPool::Cast(constant_pool.GetHeapObject())->GetObjectFromCache(id); -- Gitee