summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-06-16 16:50:11 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-06-23 20:13:59 +0000
commit91f2f71e7b936c3c9fb984aaa01d432926abb38f (patch)
tree6bfa8ac99b052014a83106f0430e5213969cb71e
parentb8b51fc4b253b3468396addd3bf72766d6d82710 (diff)
sw: fix crash on pasting from an already closed document
As pointed out by <http://crashreport.libreoffice.org/stats/signature/%60anonymous%20namespace'::lcl_checkClassification%28SwDoc%20*,SwDoc%20*%29+0x0>. Thanks to Michael Stahl for figuring out the list of steps to reproduce this bug: 1) Create a new Writer document 2) Type some text 3) Select all 4) Copy it 5) Close the document 6) Create a second Writer document 7) Paste -> crash (cherry picked from commit 1bc3c88bc9ed085bf7e173cb12f313934d92f309) Change-Id: I8cfcad465803e37ec9d01d035428c5ca953adf14 Reviewed-on: https://gerrit.libreoffice.org/26613 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--sw/source/uibase/dochdl/swdtflvr.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index ab8d5f476290..e496d29c9c9e 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -3286,7 +3286,8 @@ bool SwTransferable::PrivatePaste( SwWrtShell& rShell )
}
bool bRet = true;
- if (lcl_checkClassification(m_pWrtShell->GetDoc(), rShell.GetDoc()))
+ // m_pWrtShell is nullptr when the source document is closed already.
+ if (!m_pWrtShell || lcl_checkClassification(m_pWrtShell->GetDoc(), rShell.GetDoc()))
bRet = rShell.Paste(m_pClpDocFac->GetDoc());
if( bKillPaMs )