Kaydet (Commit) a26adf66 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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/49409Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 3c94e8c3
......@@ -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 >();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment