sc/qa/unit/tiledrendering/tiledrendering.cxx |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit e5f80cc94fc0d8874e47e4425f2c58f0dde9debe
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Fri Jan 12 11:26:01 2024 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Jan 12 16:44:02 2024 +0100

    CppunitTest_sc_tiledrendering: ignore invalid json payload for STATE_CHANGED
    
    The interesting case for this testsuite is when the json for
    LOK_CALLBACK_STATE_CHANGED has a commandName key, ignore it callback
    when that's not the case.
    
    See
    
<https://gerrit.libreoffice.org/c/core/+/161691/4#message-73673a8cedce0a5f661839553dd463983d22250a>
    for a case where this can happen, the json payload was
    
    "{
    \"state\": \"0\"
}
"
    
    Which can happen when SfxLokHelper::sendUnoStatus() thinks that the
    commandName value would be empty.
    
    Change-Id: I398319f33288742b8f46f0d07b112fd61e9a9731
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161962
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 0475a034cd8b..902fee6293ef 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -596,7 +596,13 @@ public:
 
             boost::property_tree::ptree aTree;
             boost::property_tree::read_json(aStream, aTree);
-            std::string aCommandName = aTree.get<std::string>("commandName");
+            auto it = aTree.find("commandName");
+            if (it == aTree.not_found())
+            {
+                break;
+            }
+
+            std::string aCommandName = it->second.get_value<std::string>();
             m_aStateChanges[aCommandName] = aTree;
         }
         break;

Reply via email to