summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2014-01-01 11:07:46 +0000
committerMichael Meeks <michael.meeks@collabora.com>2014-01-01 11:08:54 +0000
commit2528e5d9058dc7b88a55fcc69226161bccec2691 (patch)
treef1b957dfe6fb1f2fcd9e9ddba6a3c87b23c11f6d
parent82b56544a7a53528970632d086c3cfd8ef879335 (diff)
fdo#73021 - avoid call crash on spell-check + unit test.
Change-Id: I3588ef45617bda440f970e54274cc0985b7baed5
-rw-r--r--sc/qa/unit/ucalc.cxx13
-rw-r--r--sc/qa/unit/ucalc.hxx2
-rw-r--r--sc/source/core/data/column.cxx3
3 files changed, 17 insertions, 1 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 17c4123d79e1..283f7636e077 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -1639,6 +1639,19 @@ void Test::testEnterMixedMatrix()
m_pDoc->DeleteTab(0);
}
+void Test::testCellCopy()
+{
+ m_pDoc->InsertTab(0, "TestTab");
+ ScAddress aSrc(0,0,0);
+ ScAddress aDest(0,1,0);
+ OUString aStr("please copy me");
+ m_pDoc->SetString(aSrc, aStr);
+ CPPUNIT_ASSERT_EQUAL(m_pDoc->GetString(aSrc), aStr);
+ // copy to self - why not ?
+ m_pDoc->CopyCellToDocument(aSrc,aDest,*m_pDoc);
+ CPPUNIT_ASSERT_EQUAL(m_pDoc->GetString(aDest), aStr);
+}
+
void Test::testSheetCopy()
{
m_pDoc->InsertTab(0, "TestTab");
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 771a044579cb..5cf8306a34b8 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -213,6 +213,7 @@ public:
*/
void testPivotTableDocFunc();
+ void testCellCopy();
void testSheetCopy();
void testSheetMove();
void testExternalRef();
@@ -351,6 +352,7 @@ public:
CPPUNIT_TEST(testPivotTableNumStability);
CPPUNIT_TEST(testPivotTableFieldReference);
CPPUNIT_TEST(testPivotTableDocFunc);
+ CPPUNIT_TEST(testCellCopy);
CPPUNIT_TEST(testSheetCopy);
CPPUNIT_TEST(testSheetMove);
CPPUNIT_TEST(testExternalRef);
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 921ff2528ca9..e852e1fd0db3 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1564,7 +1564,8 @@ void ScColumn::CopyCellToDocument( SCROW nSrcRow, SCROW nDestRow, ScColumn& rDes
rDestCol.maCellTextAttrs.set(nDestRow, maCellTextAttrs.get<sc::CellTextAttr>(nSrcRow));
ScPostIt* pNote = maCellNotes.get<ScPostIt*>(nSrcRow);
rDestCol.maCellNotes.set(nDestRow, pNote);
- pNote->UpdateCaptionPos(ScAddress(rDestCol.nCol, nDestRow, rDestCol.nTab));
+ if (pNote)
+ pNote->UpdateCaptionPos(ScAddress(rDestCol.nCol, nDestRow, rDestCol.nTab));
}
else
{