changeset 63:4d65e654abf7

Converter: Handle empty percent strings again
author Andre Heinecke <andre.heinecke@intevation.de>
date Fri, 26 Aug 2016 12:24:32 +0200
parents 797435c1bbeb
children 94cac17fe5be
files src/converter.cpp
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/converter.cpp	Fri Aug 26 12:22:50 2016 +0200
+++ b/src/converter.cpp	Fri Aug 26 12:24:32 2016 +0200
@@ -230,7 +230,7 @@
                 bool ok;
                 QString percentStr = choiceMatch.captured("percent");
                 double percent;
-                if (percentStr.isNull()) {
+                if (percentStr.isEmpty()) {
                     percent = 0;
                     ok = true;
                 } else {
@@ -238,6 +238,9 @@
                 }
                 if (!ok) {
                     mErrors << "Unparsable number in string: " + choiceMatch.captured();
+                    percent = 0;
+                    percentStr = QString();
+                    /* PercentStr was not a number. */
                 }
                 makeBar(html, percent, doc);
                 xlsx.write(row, 2, percent == 0 ? QVariant() : percent);
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)