summaryrefslogtreecommitdiff
path: root/configmgr/source
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-02-08 09:07:32 +0100
committerStephan Bergmann <sbergman@redhat.com>2018-02-08 15:45:33 +0100
commita26adf6679aa13dc5821047f6aa1f05e7d0d00fd (patch)
treea817828beda4a3bf1e285b0ad15307681b432b56 /configmgr/source
parent3c94e8c3e6b1b0bce03a4cfc63df62f5ed176666 (diff)
Better return nil than an arbitrary xml:lang="..." value
...for a localized property that doesn't have a suitable value, but is nillable. E.g., /org.openoffice.Office.Writer/Insert/Caption/CaptionOrderNumberingFirst (once fixed to indeed be a localized property as apparently intended, with a follow-up commit to this) only has an explicit value (true) for xml:lang="hu", but shouldn't return that for any other locale (where the implicit default for a nil value should instead be false, cf. the else branch at the end of SwInsertConfig::Load, sw/source/uibase/config/modcfg.cxx). Change-Id: I7b991c1bc4df22bf2359175b0734e85e0844ce99 Reviewed-on: https://gerrit.libreoffice.org/49409 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'configmgr/source')
-rw-r--r--configmgr/source/access.cxx13
1 files changed, 7 insertions, 6 deletions
diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx
index 0d19af353b49..718f6339967b 100644
--- a/configmgr/source/access.cxx
+++ b/configmgr/source/access.cxx
@@ -1430,9 +1430,8 @@ rtl::Reference< ChildAccess > Access::getChild(OUString const & name) {
}
}
}
- // Defaults are the "en-US" locale, the "en" locale, the empty string
- // locale, the first child (if any), or a null ChildAccess, in that
- // order:
+ // Defaults are the "en-US" locale, the "en" locale, the empty string locale, the first child (if
+ // any, and if the property is non-nillable), or a null ChildAccess, in that order:
rtl::Reference< ChildAccess > child(getChild("en-US"));
if (child.is()) {
return child;
@@ -1445,9 +1444,11 @@ rtl::Reference< ChildAccess > Access::getChild(OUString const & name) {
if (child.is()) {
return child;
}
- std::vector< rtl::Reference< ChildAccess > > children(getAllChildren());
- if (!children.empty()) {
- return children.front();
+ if (!static_cast<LocalizedPropertyNode *>(getNode().get())->isNillable()) {
+ std::vector< rtl::Reference< ChildAccess > > children(getAllChildren());
+ if (!children.empty()) {
+ return children.front();
+ }
}
return rtl::Reference< ChildAccess >();
}