Skip to content
Permalink
Browse files

Throw an assert when using an unsupported variant type

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 309992bbe80ab620e154784fa5077c84e933339c
Showing with 1 addition and 2 deletions.
  1. +1 −2 src/core/qgsxmlutils.cpp
@@ -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;
}

0 comments on commit 309992b

Please sign in to comment.
You can’t perform that action at this time.