[Libreoffice-commits] core.git: sc/source
Henry Castro
hcastro at collabora.com
Thu Oct 20 21:19:53 UTC 2016
sc/source/ui/view/cellsh1.cxx | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
New commits:
commit d7d07ade28009d89daa44431d491081a92a04a4e
Author: Henry Castro <hcastro at collabora.com>
Date: Thu Oct 20 15:56:58 2016 -0400
sc: check SID_EDIT_POSTIT parameters
Avoid crash when execute .uno:EditAnnotation with missing
arguments
Change-Id: Iaee8694b7481933f3672a3847264a49a6503b82e
Reviewed-on: https://gerrit.libreoffice.org/30116
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Henry Castro <hcastro at collabora.com>
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 8c0040c..03983b8 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2195,20 +2195,28 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
case SID_INSERT_POSTIT:
case SID_EDIT_POSTIT:
- if ( pReqArgs )
{
- const SvxPostItAuthorItem& rAuthorItem = static_cast<const SvxPostItAuthorItem&>(pReqArgs->Get( SID_ATTR_POSTIT_AUTHOR ));
- const SvxPostItDateItem& rDateItem = static_cast<const SvxPostItDateItem&>(pReqArgs->Get( SID_ATTR_POSTIT_DATE ));
- const SvxPostItTextItem& rTextItem = static_cast<const SvxPostItTextItem&>(pReqArgs->Get( SID_ATTR_POSTIT_TEXT ));
+ const SfxPoolItem* pAuthor;
+ const SfxPoolItem* pDate;
+ const SfxPoolItem* pText;
- ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
- pTabViewShell->ReplaceNote( aPos, rTextItem.GetValue(), &rAuthorItem.GetValue(), &rDateItem.GetValue() );
+ if ( pReqArgs && pReqArgs->HasItem( SID_ATTR_POSTIT_AUTHOR, &pAuthor ) &&
+ pReqArgs->HasItem( SID_ATTR_POSTIT_DATE, &pDate) &&
+ pReqArgs->HasItem( SID_ATTR_POSTIT_TEXT, &pText) )
+ {
+ const SvxPostItAuthorItem* pAuthorItem = static_cast<const SvxPostItAuthorItem*>( pAuthor );
+ const SvxPostItDateItem* pDateItem = static_cast<const SvxPostItDateItem*>( pDate );
+ const SvxPostItTextItem* pTextItem = static_cast<const SvxPostItTextItem*>( pText );
+
+ ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
+ pTabViewShell->ReplaceNote( aPos, pTextItem->GetValue(), &pAuthorItem->GetValue(), &pDateItem->GetValue() );
+ }
+ else
+ {
+ pTabViewShell->EditNote(); // note object to edit
+ }
rReq.Done();
}
- else
- {
- pTabViewShell->EditNote(); // note object to edit
- }
break;
case FID_NOTE_VISIBLE:
More information about the Libreoffice-commits
mailing list