diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-04-17 21:16:23 +0100 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-06-17 22:27:51 +0500 |
commit | 1f2c4d6d9ceb782ae49c1cd630f4b01087282b84 (patch) | |
tree | bdbbb20ecdd3ef23250c089857778f202e201c88 | |
parent | 2e6a71265e3ed406e3c68aa02f1386508160a871 (diff) |
Handle empty range properly
Since commit 690526f95e3ee4fd25bb2c987e093543e4bc435b
(Generalize basegfx::fround for templated return type, 2024-04-14),
an assertion could fail for certain case, like
include/o3tl/unit_conversion.hxx:75: sal_Int64 o3tl::detail::MulDiv(I,
sal_Int64, sal_Int64) [I = long]: Assertion `isBetween(n,
(SAL_MIN_INT64 + d / 2) / m, (SAL_MAX_INT64 - d / 2) / m)'
The problem was unchecked case of empty B2DRange.
Change-Id: Ice9125ea557b73a7fabf64bc1ad9368f503ad525
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166101
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r-- | filter/source/msfilter/eschesdo.cxx | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx index be7f3c5bb9f2..0f7bc8db85ae 100644 --- a/filter/source/msfilter/eschesdo.cxx +++ b/filter/source/msfilter/eschesdo.cxx @@ -1156,10 +1156,19 @@ void ImplEESdrObject::Init() { // if it's a group, the unrotated range is needed for that group const basegfx::B2DRange aUnrotatedRange(getUnrotatedGroupBoundRange(mXShape)); - const Point aNewP(basegfx::fround<tools::Long>(aUnrotatedRange.getMinX()), basegfx::fround<tools::Long>(aUnrotatedRange.getMinY())); - const Size aNewS(basegfx::fround<tools::Long>(aUnrotatedRange.getWidth()), basegfx::fround<tools::Long>(aUnrotatedRange.getHeight())); + if (aUnrotatedRange.isEmpty()) + { + SetRect(tools::Rectangle()); + } + else + { + const Point aNewP(basegfx::fround<tools::Long>(aUnrotatedRange.getMinX()), + basegfx::fround<tools::Long>(aUnrotatedRange.getMinY())); + const Size aNewS(basegfx::fround<tools::Long>(aUnrotatedRange.getWidth()), + basegfx::fround<tools::Long>(aUnrotatedRange.getHeight())); - SetRect(ImplEESdrWriter::ImplMapPoint(aNewP), ImplEESdrWriter::ImplMapSize(aNewS)); + SetRect(ImplEESdrWriter::ImplMapPoint(aNewP), ImplEESdrWriter::ImplMapSize(aNewS)); + } } else { |