Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3322
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/22/3322/1
resolved fdo#63403 do not create matrix with 0 rows or cols
(cherry picked from commit 7c3ab3bc15cec211767490823539efcada4fe964)
Conflicts:
sc/source/core/tool/scmatrix.cxx
Change-Id: Icb0000bde3723c1b37713d0f26ef8305c4a199b8
---
M sc/source/core/tool/interpr1.cxx
M sc/source/core/tool/scmatrix.cxx
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 42a0825..f645ec7 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -4304,6 +4304,13 @@
SCCOL nCols;
SCROW nRows;
pMyFormulaCell->GetMatColsRows( nCols, nRows);
+ if (nCols == 0)
+ {
+ // Happens if called via ScViewFunc::EnterMatrix()
+ // ScFormulaCell::GetResultDimensions() as of course a
+ // matrix result is not available yet.
+ nCols = 1;
+ }
ScMatrixRef pResMat = GetNewMat( static_cast<SCSIZE>(nCols), 1);
if (pResMat)
{
@@ -4380,6 +4387,13 @@
SCCOL nCols;
SCROW nRows;
pMyFormulaCell->GetMatColsRows( nCols, nRows);
+ if (nRows == 0)
+ {
+ // Happens if called via ScViewFunc::EnterMatrix()
+ // ScFormulaCell::GetResultDimensions() as of course a
+ // matrix result is not available yet.
+ nRows = 1;
+ }
ScMatrixRef pResMat = GetNewMat( 1, static_cast<SCSIZE>(nRows));
if (pResMat)
{
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 47ed6e9..aa11192 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -911,7 +911,7 @@
void ScMatrixImpl::CalcPosition(SCSIZE nIndex, SCSIZE& rC, SCSIZE& rR) const
{
SCSIZE nRowSize = maCachedSize.first;
- rC = nIndex / nRowSize;
+ rC = nRowSize > 1 ? nIndex / nRowSize : nIndex;
rR = nIndex - rC*nRowSize;
}
--
To view, visit https://gerrit.libreoffice.org/3322
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icb0000bde3723c1b37713d0f26ef8305c4a199b8
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-3-6
Gerrit-Owner: Eike Rathke <erack@redhat.com>
Context
- [PATCH libreoffice-3-6] resolved fdo#63403 do not create matrix with 0 rows or cols · Eike Rathke (via Code Review)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.