[Libreoffice-commits] online.git: common/Util.cpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed May 8 18:38:45 UTC 2019


 common/Util.cpp |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 8136bbc1b5f8ca953bbdb01f8556cf57f643a61b
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Mar 9 21:21:48 2019 -0500
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Wed May 8 20:38:27 2019 +0200

    wsd: parse empty json string as empty map
    
    Change-Id: I11335e82e42e9f896ae33c2e57cb9d79b642171e
    Reviewed-on: https://gerrit.libreoffice.org/69633
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/71097
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Tested-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/common/Util.cpp b/common/Util.cpp
index 06a715320..5379fbb0d 100644
--- a/common/Util.cpp
+++ b/common/Util.cpp
@@ -569,6 +569,10 @@ namespace Util
 
     std::map<std::string, std::string> JsonToMap(const std::string& jsonString)
     {
+        std::map<std::string, std::string> map;
+        if (jsonString.empty())
+            return map;
+
         Poco::JSON::Parser parser;
         const Poco::Dynamic::Var result = parser.parse(jsonString);
         const auto& json = result.extract<Poco::JSON::Object::Ptr>();
@@ -576,7 +580,6 @@ namespace Util
         std::vector<std::string> names;
         json->getNames(names);
 
-        std::map<std::string, std::string> map;
         for (const auto& name : names)
         {
             map[name] = json->get(name).toString();


More information about the Libreoffice-commits mailing list