[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4-0' - common/Util.cpp

Ashod Nakashian (via logerrit) logerrit at kemper.freedesktop.org
Fri Oct 18 20:28:51 UTC 2019


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

New commits:
commit c5087314dc91c99efecb0fc8c9849af048bbe665
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Mar 9 21:21:48 2019 -0500
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Fri Oct 18 22:28:32 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>
    (cherry picked from commit 3e8d395618c6dfbf952fd632ea26c8ffafd39ee8)
    Reviewed-on: https://gerrit.libreoffice.org/80576
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/common/Util.cpp b/common/Util.cpp
index 6caab8efb..2a0151615 100644
--- a/common/Util.cpp
+++ b/common/Util.cpp
@@ -582,6 +582,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>();
@@ -589,7 +593,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