Kaydet (Commit) 13e55ced authored tarafından Mike Kaganski's avatar Mike Kaganski

tdf#115065: nullptr dereference

Change-Id: Iafaaafdabf9fb7947fa0b03cd38d3b4a567a41b9
Reviewed-on: https://gerrit.libreoffice.org/48110Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst 4e035a60
......@@ -297,6 +297,7 @@ public:
void testTdf113481();
void testTdf115013();
void testTdf114536();
void testTdf115065();
CPPUNIT_TEST_SUITE(SwUiWriterTest);
CPPUNIT_TEST(testReplaceForward);
......@@ -473,6 +474,7 @@ public:
CPPUNIT_TEST(testTdf113481);
CPPUNIT_TEST(testTdf115013);
CPPUNIT_TEST(testTdf114536);
CPPUNIT_TEST(testTdf115065);
CPPUNIT_TEST_SUITE_END();
private:
......@@ -5805,6 +5807,31 @@ void SwUiWriterTest::testTdf115013()
CPPUNIT_ASSERT_EQUAL(sColumnName, sColumn);
}
void SwUiWriterTest::testTdf115065()
{
// In the document, the tables have table style assigned
// Source table (first one) has two rows;
// destination (second one) has only one row
SwDoc* pDoc = createDoc("tdf115065.odt");
CPPUNIT_ASSERT(pDoc);
SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
CPPUNIT_ASSERT(pWrtShell);
pWrtShell->GotoTable("Table2");
SwRect aRect = pWrtShell->GetCurrFrame()->getFrameArea();
// Destination point is the middle of the first cell of second table
Point ptTo = Point(aRect.Left() + aRect.Width() / 2, aRect.Top() + aRect.Height() / 2);
pWrtShell->GotoTable("Table1");
aRect = pWrtShell->GetCurrFrame()->getFrameArea();
// Source point is the middle of the first cell of first table
Point ptFrom = Point(aRect.Left() + aRect.Width() / 2, aRect.Top() + aRect.Height() / 2);
pWrtShell->SelTableCol();
// The copy operation (or closing document after that) segfaulted
pWrtShell->Copy(pWrtShell, ptFrom, ptTo);
}
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
CPPUNIT_PLUGIN_IMPLEMENT();
......
......@@ -2265,8 +2265,8 @@ void SwTableCursor::DeleteBox(size_t const nPos)
bool SwTableCursor::NewTableSelection()
{
bool bRet = false;
const SwNode *pStart = GetContentNode()->FindTableBoxStartNode();
const SwNode *pEnd = GetContentNode(false)->FindTableBoxStartNode();
const SwNode *pStart = GetNode().FindTableBoxStartNode();
const SwNode *pEnd = GetNode(false).FindTableBoxStartNode();
if( pStart && pEnd )
{
const SwTableNode *pTableNode = pStart->FindTableNode();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment