From 82b8014a34463b87bc41e3e3e6b8952766e58838 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Sun, 29 Mar 2020 21:13:06 +0200 Subject: [PATCH] Properties: Fixed INSPECTABLE::Get() The code was not correct as it returned either wxAny or type T. --- include/inspectable.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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