summaryrefslogtreecommitdiffstats
path: root/common/typeindex.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-09-20 17:25:04 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-09-20 17:25:04 +0200
commit9037bf4c869cf7e8dc2801d7e126ada24d1ec1e4 (patch)
tree9801f1b942640bf36075efc4ea0a58e38d92ffa3 /common/typeindex.cpp
parentb193ad8635549a2117af6ee59ab878a78056ab9c (diff)
downloadsink-9037bf4c869cf7e8dc2801d7e126ada24d1ec1e4.tar.gz
sink-9037bf4c869cf7e8dc2801d7e126ada24d1ec1e4.zip
Don't try to index empty values.
Diffstat (limited to 'common/typeindex.cpp')
-rw-r--r--common/typeindex.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/common/typeindex.cpp b/common/typeindex.cpp
index 78195d3..b96c5b5 100644
--- a/common/typeindex.cpp
+++ b/common/typeindex.cpp
@@ -27,7 +27,10 @@ SINK_DEBUG_AREA("typeindex")
27static QByteArray getByteArray(const QVariant &value) 27static QByteArray getByteArray(const QVariant &value)
28{ 28{
29 if (value.type() == QVariant::DateTime) { 29 if (value.type() == QVariant::DateTime) {
30 return value.toDateTime().toString().toLatin1(); 30 const auto result = value.toDateTime().toString().toLatin1();
31 if (result.isEmpty()) {
32 return "nodate";
33 }
31 } 34 }
32 if (value.isValid() && !value.toByteArray().isEmpty()) { 35 if (value.isValid() && !value.toByteArray().isEmpty()) {
33 return value.toByteArray(); 36 return value.toByteArray();