From d06f2d818817820bbd8d6c1cb2d2b09ea507802f Mon Sep 17 00:00:00 2001 From: Alessandro Pasotti Date: Mon, 3 Feb 2020 13:39:51 +0100 Subject: [PATCH] Do not insert 0x0 in XML Fixes #34218 --- src/core/qgsxmlutils.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/qgsxmlutils.cpp b/src/core/qgsxmlutils.cpp index db5f1f1a897..a2bed40ef6d 100644 --- a/src/core/qgsxmlutils.cpp +++ b/src/core/qgsxmlutils.cpp @@ -161,11 +161,15 @@ QDomElement QgsXmlUtils::writeVariant( const QVariant &value, QDomDocument &doc case QVariant::LongLong: case QVariant::ULongLong: case QVariant::String: - case QVariant::Char: element.setAttribute( QStringLiteral( "type" ), QVariant::typeToName( value.type() ) ); element.setAttribute( QStringLiteral( "value" ), value.toString() ); break; + case QVariant::Char: + element.setAttribute( QStringLiteral( "type" ), QVariant::typeToName( value.type() ) ); + element.setAttribute( QStringLiteral( "value" ), value.isNull() ? QString() : value.toString() ); + break; + case QVariant::Color: element.setAttribute( QStringLiteral( "type" ), QStringLiteral( "color" ) ); element.setAttribute( QStringLiteral( "value" ), value.value< QColor >().isValid() ? QgsSymbolLayerUtils::encodeColor( value.value< QColor >() ) : QString() );