From 47d90af52a548429224c38b5c58a70116e0f7907 Mon Sep 17 00:00:00 2001
From: Eike Rathke <erack@redhat.com>
Date: Mon, 20 Jul 2015 11:46:17 +0200
Subject: check annotation caption pointers, blind fix for rhbz#1242099

Apparently there may have been situations when the caption or its shape
could not be obtained for whatever reason.

Change-Id: Ie9b97d4b3999cb4645bb6b8b688b3666cfd71ccc
---
 sc/source/filter/xml/xmlexprt.cxx | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

(limited to 'sc')

diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 969df4af1780..6abf4be812cf 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -3581,9 +3581,12 @@ void ScXMLExport::WriteAnnotation(ScMyCell& rMyCell)
         pCurrentCell = &rMyCell;
 
         SdrCaptionObj* pNoteCaption = pNote->GetOrCreateCaption(rMyCell.maCellAddress);
-        Reference<drawing::XShape> xShape( pNoteCaption->getUnoShape(), uno::UNO_QUERY );
-
-        GetShapeExport()->exportShape(xShape, SEF_DEFAULT|XMLShapeExportFlags::ANNOTATION, NULL);
+        if (pNoteCaption)
+        {
+            Reference<drawing::XShape> xShape( pNoteCaption->getUnoShape(), uno::UNO_QUERY );
+            if (xShape.is())
+                GetShapeExport()->exportShape(xShape, SEF_DEFAULT|XMLShapeExportFlags::ANNOTATION, NULL);
+        }
 
         pCurrentCell = NULL;
 
-- 
cgit