diff --git a/src/GpxDocument.cpp b/src/GpxDocument.cpp index 3780e518c..a824b2f7d 100644 --- a/src/GpxDocument.cpp +++ b/src/GpxDocument.cpp @@ -184,14 +184,14 @@ void OsmAnd::GpxDocument::writeMetadata(const Ref& metadata, const QSt writeNotNullText(xmlWriter, QStringLiteral("name"), trackName); writeNotNullText(xmlWriter, QStringLiteral("desc"), metadata->description); - if (metadata->author) + if (metadata->author && !metadata->author->name.isEmpty()) { xmlWriter.writeStartElement(QStringLiteral("author")); writeAuthor(xmlWriter, metadata->author); xmlWriter.writeEndElement(); } - if (metadata->copyright) + if (metadata->copyright && !metadata->copyright->author.isEmpty()) { xmlWriter.writeStartElement(QStringLiteral("copyright")); writeCopyright(xmlWriter, metadata->copyright); @@ -412,7 +412,9 @@ void OsmAnd::GpxDocument::writeAuthor(QXmlStreamWriter& xmlWriter, const Ref& copyright) { - xmlWriter.writeTextElement(QStringLiteral("author"), copyright->author); + if (!copyright->author.isEmpty()) + xmlWriter.writeAttribute(QStringLiteral("author"), copyright->author); + writeNotNullText(xmlWriter, QStringLiteral("year"), copyright->year); writeNotNullText(xmlWriter, QStringLiteral("license"), copyright->license); }