summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAron Budea <aron.budea@collabora.com>2021-02-15 21:46:45 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-02-17 09:12:16 +0100
commit934ed8d888abe231c014ce179e5256933b0562ed (patch)
treec995f0c56c96f1df5eee28ce38db0e186a755b90
parentfb101fd42a5fdf2d62bc74f16e982c8eb30d0c31 (diff)
Avoid crash in online on a document with comments
Crashed on a specific doc with the following backtrace: Thread 1 "kitbroker_001" received signal SIGSEGV, Segmentation fault. 0x00007f4807c76d44 in sw::annotation::SwAnnotationWin::GetPostItField (this=0x0) at /.../libreoffice/sw/inc/AnnotationWin.hxx:71 71 const SwPostItField* GetPostItField() const { return mpField; } 0 0x00007f4807c76d44 in sw::annotation::SwAnnotationWin::GetPostItField() const (this=0x0) at /.../libreoffice/sw/inc/AnnotationWin.hxx:71 1 0x00007f4807f0641b in SwXTextDocument::getPostIts(tools::JsonWriter&) (this=0x557e1d985a10, rJsonWriter=...) at /.../libreoffice/sw/source/uibase/uno/unotxdoc.cxx:3337 2 0x00007f4823216534 in getPostIts(LibreOfficeKitDocument*) (pThis=0x557e1d93c890) at /.../libreoffice/desktop/source/lib/init.cxx:3425 ... Change-Id: Ib97fd33fda936cad0c9ed3a29564fc0a49ff20c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110917 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index a3f165c1ff61..6eeec4395f04 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3345,6 +3345,11 @@ OUString SwXTextDocument::getPostIts()
{
sw::annotation::SwAnnotationWin* pWin = sidebarItem->pPostIt.get();
+ if (!pWin)
+ {
+ continue;
+ }
+
const SwPostItField* pField = pWin->GetPostItField();
const SwRect& aRect = pWin->GetAnchorRect();
tools::Rectangle aSVRect(aRect.Pos().getX(),