diff options
author | Eike Rathke <erack@redhat.com> | 2017-04-11 21:23:27 +0200 |
---|---|---|
committer | Henry Castro <hcastro@collabora.com> | 2017-05-02 21:06:20 -0400 |
commit | dc778f8e0a4d1f4587a4e97d44b41e5a67f8ba95 (patch) | |
tree | 7b0039346f138ad027513799eab311681788bbe1 | |
parent | adca2a5a7aa19597992c378d834c80c3f1a3c7bc (diff) |
bail out early if there is no caption to remove
Change-Id: Id08d82751560092fd6225131970f607dbb2e4801
-rw-r--r-- | sc/source/core/data/postit.cxx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index cadbc2edb6bd..57b55cfbec47 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -1123,12 +1123,14 @@ void ScPostIt::CreateCaption( const ScAddress& rPos, const SdrCaptionObj* pCapti void ScPostIt::RemoveCaption() { + if (!maNoteData.mxCaption) + return; /* Remove caption object only, if this note is its owner (e.g. notes in undo documents refer to captions in original document, do not remove them from drawing layer here). */ ScDrawLayer* pDrawLayer = mrDoc.GetDrawLayer(); - if (maNoteData.mxCaption && (pDrawLayer == maNoteData.mxCaption->GetModel())) + if (pDrawLayer == maNoteData.mxCaption->GetModel()) maNoteData.mxCaption.removeFromDrawPageAndFree(); // Either the caption object is gone or, because of Undo or clipboard is |