diff --git a/ecmascript/js_tagged_value-inl.h b/ecmascript/js_tagged_value-inl.h index 82b85bb969..d3bd25120a 100644 --- a/ecmascript/js_tagged_value-inl.h +++ b/ecmascript/js_tagged_value-inl.h @@ -537,7 +537,13 @@ inline bool JSTaggedValue::IsJSNativePointer() const inline bool JSTaggedValue::CheckIsJSNativePointer() const { - return IsHeapObject() && !IsInvalidValue() && GetTaggedObject()->GetClass()->IsJSNativePointer(); + if (IsHeapObject() && !IsInvalidValue()) { + auto hclass = GetTaggedObject()->GetClass(); + if (hclass != nullptr) { + return hclass->IsJSNativePointer(); + } + } + return false; } inline bool JSTaggedValue::IsSymbol() const @@ -552,7 +558,13 @@ inline bool JSTaggedValue::IsJSProxy() const inline bool JSTaggedValue::CheckIsJSProxy() const { - return IsHeapObject() && !IsInvalidValue() && GetTaggedObject()->GetClass()->IsJSProxy(); + if (IsHeapObject() && !IsInvalidValue()) { + auto hclass = GetTaggedObject()->GetClass(); + if (hclass != nullptr) { + return hclass->IsJSProxy(); + } + } + return false; } inline bool JSTaggedValue::IsBoolean() const @@ -996,7 +1008,13 @@ inline bool JSTaggedValue::IsJSFunctionBase() const inline bool JSTaggedValue::CheckIsJSFunctionBase() const { - return IsHeapObject() && !IsInvalidValue() && GetTaggedObject()->GetClass()->IsJSFunctionBase(); + if (IsHeapObject() && !IsInvalidValue()) { + auto hclass = GetTaggedObject()->GetClass(); + if (hclass != nullptr) { + return hclass->IsJSFunctionBase(); + } + } + return false; } inline bool JSTaggedValue::IsBoundFunction() const