diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2024-04-07 20:23:26 +0100 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-04-08 23:16:25 +0200 |
commit | e7bb3a52067c426eedffddf86e7d5f0903562da2 (patch) | |
tree | a655ee4aed8ceedc61dde01f68619f7202344045 /sw/source | |
parent | c16f7ca43bb338f23895733ee499505ee6a6e72e (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 'sw/source')
-rw-r--r-- | sw/source/uibase/dochdl/swdtflvr.cxx | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 7e3ea868c816..e1a82a48bd86 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -2177,7 +2177,7 @@ bool SwTransferable::PasteFileContent( const TransferableDataHelper& rData, [[fallthrough]]; // because then test if we get a stream default: - if( rData.GetSotStorageStream( nFormat, xStrm ) ) + if( (xStrm = rData.GetSotStorageStream( nFormat )) ) { if( ( SotClipboardFormatId::HTML_SIMPLE == nFormat ) || ( SotClipboardFormatId::HTML_NO_COMMENT == nFormat ) ) @@ -2767,8 +2767,7 @@ bool SwTransferable::PasteSdrFormat( const TransferableDataHelper& rData, const Point* pPt, SotExchangeActionFlags nActionFlags, bool bNeedToSelectBeforePaste) { bool bRet = false; - std::unique_ptr<SvStream> xStrm; - if( rData.GetSotStorageStream( SotClipboardFormatId::DRAWING, xStrm )) + if( std::unique_ptr<SvStream> xStrm = rData.GetSotStorageStream( SotClipboardFormatId::DRAWING )) { xStrm->SetVersion( SOFFICE_FILEFORMAT_50 ); @@ -2808,9 +2807,7 @@ bool SwTransferable::PasteGrf( const TransferableDataHelper& rData, SwWrtShell& case SotClipboardFormatId::SVXB: { - std::unique_ptr<SvStream> xStm; - - if(rData.GetSotStorageStream(SotClipboardFormatId::SVXB, xStm)) + if (std::unique_ptr<SvStream> xStm = rData.GetSotStorageStream(SotClipboardFormatId::SVXB)) { TypeSerializer aSerializer(*xStm); aSerializer.readGraphic(aGraphic); |