Commit 96956b94 authored by Laurent Montel's avatar Laurent Montel 😁

Fix crash with old data (before my fixing about simple quote)

parent 2bae5171
Pipeline #44078 passed with stage
in 10 minutes and 1 second
...@@ -85,8 +85,14 @@ bool ImportKMailAutocorrection::import(const QString &fileName, LoadAttribute lo ...@@ -85,8 +85,14 @@ bool ImportKMailAutocorrection::import(const QString &fileName, LoadAttribute lo
if (xml.readNextStartElement()) { if (xml.readNextStartElement()) {
const QStringRef tagname = xml.name(); const QStringRef tagname = xml.name();
if (tagname == QLatin1String("simplequote")) { if (tagname == QLatin1String("simplequote")) {
mTypographicSingleQuotes.begin = xml.attributes().value(QStringLiteral("begin")).toString().at(0); const QString simpleQuoteBegin = xml.attributes().value(QStringLiteral("begin")).toString();
mTypographicSingleQuotes.end = xml.attributes().value(QStringLiteral("end")).toString().at(0); if (!simpleQuoteBegin.isEmpty()) { //crash when we have old data with bug.
mTypographicSingleQuotes.begin = simpleQuoteBegin.at(0);
}
const QString simpleQuoteEnd = xml.attributes().value(QStringLiteral("end")).toString();
if (!simpleQuoteEnd.isEmpty()) { //crash when we have old data with bug.
mTypographicSingleQuotes.end = simpleQuoteEnd.at(0);
}
xml.skipCurrentElement(); xml.skipCurrentElement();
} else { } else {
xml.skipCurrentElement(); xml.skipCurrentElement();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment