Skip to content

Commit

Permalink
Throw an assert when using an unsupported variant type
Browse files Browse the repository at this point in the history
with QgsXmlUtils::writeVariant

These were previously written as strings yet could not be
restored by QgsXmlUtils::readVariant. Better to throw
an assert so that it's clear that these types are unsupported
and that support needs to be added.
  • Loading branch information
nyalldawson committed Sep 1, 2018
1 parent 4ae23b6 commit 309992b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/core/qgsxmlutils.cpp
Expand Up @@ -154,8 +154,7 @@ QDomElement QgsXmlUtils::writeVariant( const QVariant &value, QDomDocument &doc
break;

default:
element.setAttribute( QStringLiteral( "type" ), QStringLiteral( "Unknown" ) );
element.setAttribute( QStringLiteral( "value" ), value.toString() );
Q_ASSERT_X( false, "QgsXmlUtils::writeVariant", "unsupported variant type" );
break;
}

Expand Down

0 comments on commit 309992b

Please sign in to comment.