return NULL from GetVoidPtr() for NULL variants instead of asserting (closes #9873)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58392 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -321,6 +321,9 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Gets the void pointer value.
|
Gets the void pointer value.
|
||||||
|
|
||||||
|
Notice that this method can be used for null objects (i.e. those for
|
||||||
|
which IsNull() returns @true) and will return @NULL for them.
|
||||||
*/
|
*/
|
||||||
void* GetVoidPtr() const;
|
void* GetVoidPtr() const;
|
||||||
|
|
||||||
|
@@ -1182,7 +1182,11 @@ void wxVariant::operator= (void* value)
|
|||||||
|
|
||||||
void* wxVariant::GetVoidPtr() const
|
void* wxVariant::GetVoidPtr() const
|
||||||
{
|
{
|
||||||
wxASSERT( (GetType() == wxT("void*")) );
|
// handling this specially is convenient when working with COM, see #9873
|
||||||
|
if ( IsNull() )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
wxASSERT( GetType() == wxT("void*") );
|
||||||
|
|
||||||
return (void*) ((wxVariantDataVoidPtr*) m_data)->GetValue();
|
return (void*) ((wxVariantDataVoidPtr*) m_data)->GetValue();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user