summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-04-29 20:25:52 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-04-29 20:42:04 +0200
commitd4a12421f2b0aafe97f8ab78017261969c36ae0e (patch)
tree4183a5c365ac2a8aed70d362c355cf8cb1ce1b09 /desktop
parent2d69d539bf1ee1ee413dd26d772d4b318b51d63f (diff)
desktop: pJSON may be 0 in jsonToPropertyValues()
Change-Id: I1ed9a4e1f1ecabf48ed3edb7cf6623261e2f4570
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/init.cxx37
1 files changed, 20 insertions, 17 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 67e4750c05cb..44cf2b0a9b5e 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -706,25 +706,28 @@ static void doc_postKeyEvent(LibreOfficeKitDocument* pThis, int nType, int nChar
static void jsonToPropertyValues(const char* pJSON, uno::Sequence<beans::PropertyValue>& rPropertyValues)
{
- boost::property_tree::ptree aTree;
- std::stringstream aStream(pJSON);
- boost::property_tree::read_json(aStream, aTree);
-
std::vector<beans::PropertyValue> aArguments;
- for (const std::pair<std::string, boost::property_tree::ptree>& rPair : aTree)
+ if (pJSON)
{
- const std::string& rType = rPair.second.get<std::string>("type");
- const std::string& rValue = rPair.second.get<std::string>("value");
-
- beans::PropertyValue aValue;
- aValue.Name = OUString::fromUtf8(rPair.first.c_str());
- if (rType == "string")
- aValue.Value <<= OUString::fromUtf8(rValue.c_str());
- else if (rType == "boolean")
- aValue.Value <<= OString(rValue.c_str()).toBoolean();
- else
- SAL_WARN("desktop.lib", "jsonToPropertyValues: unhandled type '"<<rType<<"'");
- aArguments.push_back(aValue);
+ boost::property_tree::ptree aTree;
+ std::stringstream aStream(pJSON);
+ boost::property_tree::read_json(aStream, aTree);
+
+ for (const std::pair<std::string, boost::property_tree::ptree>& rPair : aTree)
+ {
+ const std::string& rType = rPair.second.get<std::string>("type");
+ const std::string& rValue = rPair.second.get<std::string>("value");
+
+ beans::PropertyValue aValue;
+ aValue.Name = OUString::fromUtf8(rPair.first.c_str());
+ if (rType == "string")
+ aValue.Value <<= OUString::fromUtf8(rValue.c_str());
+ else if (rType == "boolean")
+ aValue.Value <<= OString(rValue.c_str()).toBoolean();
+ else
+ SAL_WARN("desktop.lib", "jsonToPropertyValues: unhandled type '"<<rType<<"'");
+ aArguments.push_back(aValue);
+ }
}
rPropertyValues = comphelper::containerToSequence(aArguments);
}