1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-17 19:37:09 +02:00

Check if a NULL pointer should be converted into a QVariant

This commit is contained in:
Uwe L. Korn
2014-04-18 19:22:22 +01:00
parent d368f3ee9e
commit 1f65fcf1d9

View File

@@ -36,8 +36,13 @@ QVariantMap
qobject2qvariant( const QObject* object ) qobject2qvariant( const QObject* object )
{ {
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 ) #if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
const QMetaObject* metaObject = object->metaObject();
QVariantMap map; QVariantMap map;
if ( object == NULL )
{
return map;
}
const QMetaObject* metaObject = object->metaObject();
for ( int i = 0; i < metaObject->propertyCount(); ++i ) for ( int i = 0; i < metaObject->propertyCount(); ++i )
{ {
QMetaProperty metaproperty = metaObject->property( i ); QMetaProperty metaproperty = metaObject->property( i );