summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarkus Mittendrein <git@maxmitti.tk>2015-10-12 14:19:54 +0200
committerMarkus Mittendrein <git@maxmitti.tk>2015-10-12 14:24:48 +0200
commit988087b43a52c24e56cdd83cdd1c86bb927e4ad9 (patch)
tree17cc03917509962964ce9bb45ec1571e2de0978a /src
parent4d799abc4051ca55c35ba814e99368347dc93719 (diff)
downloadmanager-988087b43a52c24e56cdd83cdd1c86bb927e4ad9.tar.gz
manager-988087b43a52c24e56cdd83cdd1c86bb927e4ad9.zip
Fix crash in Util::trimQuotes
Diffstat (limited to 'src')
-rw-r--r--src/Util.cpp4
-rw-r--r--src/Util.hpp8
2 files changed, 9 insertions, 3 deletions
diff --git a/src/Util.cpp b/src/Util.cpp
index 4db3773..78dd8d2 100644
--- a/src/Util.cpp
+++ b/src/Util.cpp
@@ -1,8 +1,10 @@
#include "Util.hpp"
namespace Util {
- QString& trimQuotes(QString&& string, bool& trimmed)
+ QString trimQuotes(QString string, bool& trimmed)
{
+ if(string.isEmpty()) return string;
+
trimmed = false;
if(string.length() >= 2 && string.at(0) == '"' && string.at(string.length() - 1) == '"')
{
diff --git a/src/Util.hpp b/src/Util.hpp
index b0d1f78..5826b1b 100644
--- a/src/Util.hpp
+++ b/src/Util.hpp
@@ -1,8 +1,12 @@
#pragma once
#include <QString>
+#include <QMap>
namespace Util {
- QString& trimQuotes(QString&& string, bool& trimmed);
- QString& trimQuotes(const QString& string, bool& trimmed);
+ static const QMap<QChar, QChar> unescapeChars {
+ {'n', '\n'},
+ };
+
+ QString trimQuotes(QString string, bool& trimmed);
}