diff --git a/include/property.h b/include/property.h index c883f82a1f..55359045e8 100644 --- a/include/property.h +++ b/include/property.h @@ -538,6 +538,16 @@ public: return s_undef; } + bool IsValueDefined( T value ) const + { + int idx = m_choices.Index( static_cast( value ) ); + + if( idx >= 0 && idx < (int) m_choices.GetCount() ) + return true; + + return false; + } + const T ToEnum( const wxString value ) { if( m_reverseMap.count( value ) ) @@ -576,6 +586,10 @@ private: { \ type value = GetValue( src ); \ ENUM_MAP& conv = ENUM_MAP::Instance(); \ + if( ! conv.IsValueDefined( value ) ) \ + { \ + return false; \ + } \ if( dstType->CheckType() ) \ { \ wxAnyValueTypeImpl::SetValue( conv.ToString( value ), dst ); \