svx/source/svdraw/svdopath.cxx | 11 +++++++---- sw/qa/extras/ooxmlexport/data/cloud.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport21.cxx | 8 ++++++++ 3 files changed, 15 insertions(+), 4 deletions(-)
New commits: commit 08da27fc377f443d1d6698f4a061fa462849062d Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Wed May 22 20:22:08 2024 +0500 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Wed May 22 20:53:05 2024 +0200 Handle empty range correctly Otherwise, the translation gets MAX_DBL value, and scaling becomes 0. After commit 690526f95e3ee4fd25bb2c987e093543e4bc435b (Generalize basegfx::fround for templated return type, 2024-04-15) this made some documents (e.g., bugdoc in tdf#85132) fail an assertion in debug builds, which allowed to find and fix this problem. Change-Id: I14cb0afd0c8d884f505efb921907cc8e86418da2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167965 Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Tested-by: Jenkins diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index 322b7444960f..935397d1ea61 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -2850,11 +2850,14 @@ bool SdrPathObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DP // itself, else this method will no longer return the full polygon information (curve will // be lost) const basegfx::B2DRange aPolyRangeNoCurve(basegfx::utils::getRange(rPolyPolygon)); - aScale = aPolyRangeNoCurve.getRange(); - aTranslate = aPolyRangeNoCurve.getMinimum(); + if (!aPolyRangeNoCurve.isEmpty()) + { + aScale = aPolyRangeNoCurve.getRange(); + aTranslate = aPolyRangeNoCurve.getMinimum(); - // define matrix for move polygon to zero point - aMoveToZeroMatrix.translate(-aTranslate.getX(), -aTranslate.getY()); + // define matrix for move polygon to zero point + aMoveToZeroMatrix.translate(-aTranslate.getX(), -aTranslate.getY()); + } } } diff --git a/sw/qa/extras/ooxmlexport/data/cloud.docx b/sw/qa/extras/ooxmlexport/data/cloud.docx new file mode 100644 index 000000000000..74c4ac91031c Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/cloud.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index 6cfbe8d783fc..1c55be3df2cf 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -553,6 +553,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf154369, "tdf154369.docx") "color"_ostr, "00527d55"); } +CPPUNIT_TEST_FIXTURE(Test, testEmptyObjectRange) +{ + // Before the fix, this failed an assertion like this: + // Assertion failed: isBetween(n, (SAL_MIN_INT64 + d / 2) / m, (SAL_MAX_INT64 - d / 2) / m), + // file C:\lo+ loadAndSave("cloud.docx"); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT();