Properties: Fixed INSPECTABLE::Get<T>()

The code was not correct as it returned either wxAny or type T.
This commit is contained in:
Maciej Suminski 2020-03-29 21:13:06 +02:00 committed by Jon Evans
parent b7a734ad61
commit 82b8014a34
1 changed files with 6 additions and 3 deletions

View File

@ -92,9 +92,12 @@ public:
T Get( PROPERTY_BASE* aProperty ) const
{
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
TYPE_ID thisType = TYPE_HASH( *this );
void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
return object ? aProperty->get<T>( object ) : T();
const void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
if( !object )
throw std::runtime_error( "Could not cast INSPECTABLE to the requested type" );
return aProperty->get<T>( object );
}
template<typename T>