From cdc840a8f6588f656713bdb5a890f8b71787b387 Mon Sep 17 00:00:00 2001 From: Xusheng Date: Wed, 7 Sep 2022 19:34:24 +0800 Subject: Fix comparison operator for BinaryNinja::Ref --- binaryninjaapi.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'binaryninjaapi.h') diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 1a0f1550..6f0ca20a 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -101,6 +101,15 @@ namespace BinaryNinja { return obj->GetObject(); } + // This is needed by code like + // bool operator==(const T* obj) const { return T::GetObject(m_obj) == T::GetObject(obj); } + static T* GetObject(const CoreRefCountObject* obj) + { + if (!obj) + return nullptr; + return obj->GetObject(); + } + void AddRef() { if (m_object && (m_refs != 0)) -- cgit v1.3.1