diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2024-01-12 11:26:01 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2024-01-16 11:14:31 +0100 |
commit | 315867352d175b2f04ff54765424ae16057a4120 (patch) | |
tree | 852218c47467629d173dad36925fe41832ddbe9e /sc | |
parent | 8a53156023be536acb644247e4aa5f929b6f9060 (diff) |
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
"{\n \"state\": \"0\"\n}\n"
Which can happen when SfxLokHelper::sendUnoStatus() thinks that the
commandName value would be empty.
(cherry picked from commit e5f80cc94fc0d8874e47e4425f2c58f0dde9debe)
Change-Id: I398319f33288742b8f46f0d07b112fd61e9a9731
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/tiledrendering/tiledrendering.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index c5de130ee735..737c1a534cce 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; |