diff --git a/include/inspectable.h b/include/inspectable.h index cf3a419510..5c8500cb61 100644 --- a/include/inspectable.h +++ b/include/inspectable.h @@ -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( 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( object ); } template