summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatarina Behrens <bubli@bubli.org>2013-09-13 17:29:12 +0200
committerEike Rathke <erack@redhat.com>2013-09-18 11:11:51 +0000
commitf87e658fb4e580ea874e30cedfe4b40a86e76b21 (patch)
treeda88ec8d1f9e159cfc7a10ce51d71bc00ac46e19
parent52bd2f21fe6b4388948643514bca05a7b4f87849 (diff)
Avoid crash when a comment contains data, but no text
calling back() on empty vector results in undef behaviour Crash originally reported here: http://lists.freedesktop.org/archives/libreoffice/2013-September/055827.html Change-Id: Ibefdc7e2495fc31d748c16fedd3cee5eb957bfa2 (cherry picked from commit 3750deae3e2d8fcf8bcf795fe327e1da370a2c4d) Reviewed-on: https://gerrit.libreoffice.org/5974 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
-rw-r--r--oox/source/ppt/presentationfragmenthandler.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx
index 247b81b981a1..826130cf65a9 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -323,8 +323,12 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 nSlide, sal_Bool bFirst
//set comment chars for last comment on slide
SlideFragmentHandler* comment_handler =
dynamic_cast<SlideFragmentHandler*>(xCommentsFragmentHandler.get());
+ // some comments have no text -> set empty string as text to avoid
+ // crash (back() on empty vector is undefined) and losing other
+ // comment data that might be there (author, position, timestamp etc.)
pCommentsPersistPtr->getCommentsList().cmLst.back().setText(
- comment_handler->getCharVector().back() );
+ comment_handler->getCharVector().empty() ? "" :
+ comment_handler->getCharVector().back() );
pCommentsPersistPtr->getCommentAuthors().setValues(maAuthorList);
//insert all comments from commentsList