48 lines
2.1 KiB
Diff
48 lines
2.1 KiB
Diff
|
From dcea315173ffc1d5d42aa2734636fe97cd0180d9 Mon Sep 17 00:00:00 2001
|
||
|
From: David Faure <faure@kde.org>
|
||
|
Date: Sun, 9 Aug 2020 10:55:41 +0200
|
||
|
Subject: [PATCH 18/54] Fix assert with invalid
|
||
|
~/.local/share/autocorrect/custom-en-US.xml
|
||
|
|
||
|
---
|
||
|
.../textediting/autocorrection/Autocorrect.cpp | 16 ++++++++++++----
|
||
|
1 file changed, 12 insertions(+), 4 deletions(-)
|
||
|
|
||
|
diff --git a/plugins/textediting/autocorrection/Autocorrect.cpp b/plugins/textediting/autocorrection/Autocorrect.cpp
|
||
|
index 4d17c0d79c2..61674276e9f 100644
|
||
|
--- a/plugins/textediting/autocorrection/Autocorrect.cpp
|
||
|
+++ b/plugins/textediting/autocorrection/Autocorrect.cpp
|
||
|
@@ -845,8 +845,12 @@ void Autocorrect::readAutocorrectXmlEntry(const QString &fname, bool onlyCustomi
|
||
|
QDomNodeList nl = doubleQuote.childNodes();
|
||
|
if(nl.count()==1) {
|
||
|
QDomElement element = nl.item(0).toElement();
|
||
|
- m_typographicDoubleQuotes.begin = element.attribute(QLatin1String("begin")).at(0);
|
||
|
- m_typographicDoubleQuotes.end = element.attribute(QLatin1String("end")).at(0);
|
||
|
+ const QString beginStr = element.attribute(QLatin1String("begin"));
|
||
|
+ const QString endStr = element.attribute(QLatin1String("end"));
|
||
|
+ if (!beginStr.isEmpty() && !endStr.isEmpty()) {
|
||
|
+ m_typographicDoubleQuotes.begin = beginStr.at(0);
|
||
|
+ m_typographicDoubleQuotes.end = endStr.at(0);
|
||
|
+ }
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@@ -855,8 +859,12 @@ void Autocorrect::readAutocorrectXmlEntry(const QString &fname, bool onlyCustomi
|
||
|
QDomNodeList nl = singleQuote.childNodes();
|
||
|
if(nl.count()==1) {
|
||
|
QDomElement element = nl.item(0).toElement();
|
||
|
- m_typographicSingleQuotes.begin = element.attribute(QLatin1String("begin")).at(0);
|
||
|
- m_typographicSingleQuotes.end = element.attribute(QLatin1String("end")).at(0);
|
||
|
+ const QString beginStr = element.attribute(QLatin1String("begin"));
|
||
|
+ const QString endStr = element.attribute(QLatin1String("end"));
|
||
|
+ if (!beginStr.isEmpty() && !endStr.isEmpty()) {
|
||
|
+ m_typographicSingleQuotes.begin = beginStr.at(0);
|
||
|
+ m_typographicSingleQuotes.end = endStr.at(0);
|
||
|
+ }
|
||
|
}
|
||
|
}
|
||
|
|
||
|
--
|
||
|
2.31.1
|
||
|
|