summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2021-02-23 15:22:47 +0200
committerJustin Luth <justin_luth@sil.org>2021-02-24 19:53:29 +0100
commit76d2a9fd461dde817fbb1c5d4aa830cb2c42b504 (patch)
treea9a9c29497a439818e8491eb4c69e7375173774a /sw/source
parenta0cc84e63cd3bcc028aca093335c5528f7c4de6a (diff)
tdf#140572 docx export: avoid DocDefault superscript crash
This fixes a crash situation introduced in LO 6.4 by commit d71cf6390a89ea6a4fab724e3a7996f28ca33661. The crash was occurring when the DocDefaults were being exported. Since there was no character or paragraph context, the lookup of the related fontsize was crashing. Moving this variable closer to where it is used "just happens" to fix the crash. Because the DocDefault is considered a style, we are just exporting the superscript/subscript as a default size, and so don't need to know the font size. Thus a style-context position can't cause the crash again. So it isn't a great fix, and leaves the possibility for the same thing to happen in other situations (like RES_CHRATR_BACKGROUND), but at least it quickly solves this known problem, and is easily backportable, as well as following best practice of keeping variables as close to where they are used as possible - eliminating some unnecessary lookups. I did look for a more generic fix (or whether other properties could be affected) and didn't come with any clear examples or a better fix. Change-Id: I03dc3d74a5148973c065cadb09c5c79068f12df1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111403 Tested-by: Jenkins Tested-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 9d2833370b74..7a9ddc9e79a5 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7498,9 +7498,9 @@ void DocxAttributeOutput::CharEscapement( const SvxEscapementItem& rEscapement )
if ( !sIss.isEmpty() )
m_pSerializer->singleElementNS(XML_w, XML_vertAlign, FSNS(XML_w, XML_val), sIss);
- const SvxFontHeightItem& rItem = m_rExport.GetItem(RES_CHRATR_FONTSIZE);
if (sIss.isEmpty() || sIss.match("baseline"))
{
+ const SvxFontHeightItem& rItem = m_rExport.GetItem(RES_CHRATR_FONTSIZE);
float fHeight = rItem.GetHeight();
OString sPos = OString::number( round(( fHeight * nEsc ) / 1000) );
m_pSerializer->singleElementNS(XML_w, XML_position, FSNS(XML_w, XML_val), sPos);