summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/viewfun5.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2024-04-07 20:23:26 +0100
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-04-08 23:16:25 +0200
commite7bb3a52067c426eedffddf86e7d5f0903562da2 (patch)
treea655ee4aed8ceedc61dde01f68619f7202344045 /sc/source/ui/view/viewfun5.cxx
parentc16f7ca43bb338f23895733ee499505ee6a6e72e (diff)
cid#1596254 Null pointer dereferences in GetSotStorageStream
Re-arrange the calling convention to make it obvious that a valid stream is the same as a good (true) result. Change-Id: I974b023a8e7231e70ab649628fdbe43c33001e5b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165874 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui/view/viewfun5.cxx')
-rw-r--r--sc/source/ui/view/viewfun5.cxx9
1 files changed, 3 insertions, 6 deletions
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index 9f82c96df810..25e89487f96f 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -231,8 +231,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
}
else if (nFormatId == SotClipboardFormatId::SVXB)
{
- std::unique_ptr<SvStream> xStm;
- if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::SVXB, xStm ) )
+ if (std::unique_ptr<SvStream> xStm = aDataHelper.GetSotStorageStream( SotClipboardFormatId::SVXB ) )
{
Graphic aGraphic;
TypeSerializer aSerializer(*xStm);
@@ -242,8 +241,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
}
else if ( nFormatId == SotClipboardFormatId::DRAWING )
{
- std::unique_ptr<SvStream> xStm;
- if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::DRAWING, xStm ) )
+ if (std::unique_ptr<SvStream> xStm = aDataHelper.GetSotStorageStream( SotClipboardFormatId::DRAWING ))
{
MakeDrawLayer(); // before loading model, so 3D factory has been created
@@ -676,8 +674,7 @@ bool ScViewFunc::PasteDataFormatFormattedText( SotClipboardFormatId nFormatId,
pObj->SetOverwriting( true );
auto pStrBuffer = std::make_shared<OUString>();
- std::unique_ptr<SvStream> xStream;
- if ( rDataHelper.GetSotStorageStream( nFormatId, xStream ) && xStream )
+ if (std::unique_ptr<SvStream> xStream = rDataHelper.GetSotStorageStream( nFormatId ) )
{
// Static variables for per-session storage. This could be
// changed to longer-term storage in future.