You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.2 KiB
39 lines
1.2 KiB
From 56f64173991204a1eea4bf6789d68555b94e3eae Mon Sep 17 00:00:00 2001
|
|
From: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
|
|
Date: Wed, 9 Dec 2015 13:20:20 +0100
|
|
Subject: [PATCH 25/34] Fix crash reading lists from configuration
|
|
|
|
Check the end of line to avoid taking a string reference from a
|
|
null string resulting in a crash.
|
|
---
|
|
src/common/ConfigReader.cpp | 13 ++++++++-----
|
|
1 file changed, 8 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/src/common/ConfigReader.cpp b/src/common/ConfigReader.cpp
|
|
index cfc9940..acf880f 100644
|
|
--- a/src/common/ConfigReader.cpp
|
|
+++ b/src/common/ConfigReader.cpp
|
|
@@ -30,11 +30,14 @@
|
|
|
|
QTextStream &operator>>(QTextStream &str, QStringList &list) {
|
|
list.clear();
|
|
- foreach(const QStringRef &s, str.readLine().splitRef(QLatin1Char(',')))
|
|
- {
|
|
- QStringRef trimmed = s.trimmed();
|
|
- if (!trimmed.isEmpty())
|
|
- list.append(trimmed.toString());
|
|
+ QString line = str.readLine();
|
|
+ while (!line.isNull()) {
|
|
+ Q_FOREACH (const QStringRef &s, line.splitRef(QLatin1Char(','))) {
|
|
+ QStringRef trimmed = s.trimmed();
|
|
+ if (!trimmed.isEmpty())
|
|
+ list.append(trimmed.toString());
|
|
+ }
|
|
+ line = str.readLine();
|
|
}
|
|
return str;
|
|
}
|
|
--
|
|
2.5.0
|
|
|