diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-12-21 10:28:28 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-12-21 19:07:54 +0000 |
commit | d5dd8a4e77e858b02ac626d8902fffa2d010ae49 (patch) | |
tree | 24b25024abbfafc578f4d0445b4107455459f27c /oox | |
parent | 0100cfdd2d4147b5d986b131fb1143b21cedbfa5 (diff) |
oox: fix crash in oox::drawingml::Transform2DContext::onCreateContext
Similar to 68a259f5af8757923be8a226631f38366fe8e37b
"tdf#152606: fix crash when opening specific pptx"
See https://crashreport.libreoffice.org/stats/signature/oox::drawingml::Transform2DContext::onCreateContext(long,oox::AttributeList%20const%20&)
Change-Id: Iac769edadb72590d8aef1ea3fc3845fce7a0bd86
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144648
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit ad3a1ed90fc5a19c0191ec572f12f359f98a0958)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144669
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/drawingml/transform2dcontext.cxx | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/oox/source/drawingml/transform2dcontext.cxx b/oox/source/drawingml/transform2dcontext.cxx index 9d295d826b63..1cd67d1192db 100644 --- a/oox/source/drawingml/transform2dcontext.cxx +++ b/oox/source/drawingml/transform2dcontext.cxx @@ -328,26 +328,29 @@ ContextHandlerRef Transform2DContext::onCreateContext( sal_Int32 aElementToken, } } - // Calculate indent offsets - sal_Int32 nOffsetLeft = aUnrotatedTxXfrm.X - aPresetTextRectangle.X; - sal_Int32 nOffsetTop = aUnrotatedTxXfrm.Y - aPresetTextRectangle.Y; - sal_Int32 nOffsetRight - = aPresetTextRectangle.Width - aUnrotatedTxXfrm.Width - nOffsetLeft; - sal_Int32 nOffsetBottom - = aPresetTextRectangle.Height - aUnrotatedTxXfrm.Height - nOffsetTop; + if(mrShape.getTextBody()) + { + // Calculate indent offsets + sal_Int32 nOffsetLeft = aUnrotatedTxXfrm.X - aPresetTextRectangle.X; + sal_Int32 nOffsetTop = aUnrotatedTxXfrm.Y - aPresetTextRectangle.Y; + sal_Int32 nOffsetRight + = aPresetTextRectangle.Width - aUnrotatedTxXfrm.Width - nOffsetLeft; + sal_Int32 nOffsetBottom + = aPresetTextRectangle.Height - aUnrotatedTxXfrm.Height - nOffsetTop; - if (nOffsetLeft) - mrShape.getTextBody()->getTextProperties().moTextOffLeft - = GetCoordinate(nOffsetLeft); - if (nOffsetTop) - mrShape.getTextBody()->getTextProperties().moTextOffUpper - = GetCoordinate(nOffsetTop); - if (nOffsetRight) - mrShape.getTextBody()->getTextProperties().moTextOffRight - = GetCoordinate(nOffsetRight); - if (nOffsetBottom) - mrShape.getTextBody()->getTextProperties().moTextOffLower - = GetCoordinate(nOffsetBottom); + if (nOffsetLeft) + mrShape.getTextBody()->getTextProperties().moTextOffLeft + = GetCoordinate(nOffsetLeft); + if (nOffsetTop) + mrShape.getTextBody()->getTextProperties().moTextOffUpper + = GetCoordinate(nOffsetTop); + if (nOffsetRight) + mrShape.getTextBody()->getTextProperties().moTextOffRight + = GetCoordinate(nOffsetRight); + if (nOffsetBottom) + mrShape.getTextBody()->getTextProperties().moTextOffLower + = GetCoordinate(nOffsetBottom); + } } break; } |