[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kbibtex/kbibtex/0.7] src/networking/zotero: Checking validity of string-to-number coversion
From:       Thomas Fischer <null () kde ! org>
Date:       2017-03-22 18:41:54
Message-ID: E1cqlCk-00009A-Md () code ! kde ! org
[Download RAW message or body]

Git commit edab1a8a3289689c5429dfd83a9f0e54cd078431 by Thomas Fischer.
Committed on 17/03/2017 at 20:10.
Pushed by thomasfischer into branch 'kbibtex/0.7'.

Checking validity of string-to-number coversion

... by testing if the boolean parameter passed to 'toInt(*bool)'
got set to 'true' or 'false'.

M  +1    -1    src/networking/zotero/tags.cpp

https://commits.kde.org/kbibtex/edab1a8a3289689c5429dfd83a9f0e54cd078431

diff --git a/src/networking/zotero/tags.cpp b/src/networking/zotero/tags.cpp
index 671d1fb2..bf5b5b2d 100644
--- a/src/networking/zotero/tags.cpp
+++ b/src/networking/zotero/tags.cpp
@@ -117,7 +117,7 @@ void Tags::finishedFetchingTags()
                     else if (tt == QXmlStreamReader::StartElement && \
xmlReader.name() == QLatin1String("numItems")) {  bool ok = false;
                         count = \
                xmlReader.readElementText(QXmlStreamReader::IncludeChildElements).toInt(&ok);
                
-                        if (count < 1) count = -1;
+                        if (!ok || count < 1) count = -1;
                     } else if (tt == QXmlStreamReader::EndElement && \
xmlReader.name() == QLatin1String("entry"))  break;
                 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic