diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-09-20 17:25:04 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-09-20 17:25:04 +0200 |
commit | 9037bf4c869cf7e8dc2801d7e126ada24d1ec1e4 (patch) | |
tree | 9801f1b942640bf36075efc4ea0a58e38d92ffa3 | |
parent | b193ad8635549a2117af6ee59ab878a78056ab9c (diff) | |
download | sink-9037bf4c869cf7e8dc2801d7e126ada24d1ec1e4.tar.gz sink-9037bf4c869cf7e8dc2801d7e126ada24d1ec1e4.zip |
Don't try to index empty values.
-rw-r--r-- | common/typeindex.cpp | 5 |
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") | |||
27 | static QByteArray getByteArray(const QVariant &value) | 27 | static 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(); |