chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx |   12 
+++++-----
 chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx |   12 
+++++-----
 sd/source/ui/slidesorter/controller/SlsClipboard.cxx               |    2 +
 sw/source/core/edit/edfcol.cxx                                     |    2 -
 sw/source/core/txtnode/fmtatr2.cxx                                 |    4 +--
 sw/source/core/unocore/unochart.cxx                                |    4 +--
 sw/source/core/unocore/unocrsrhelper.cxx                           |    2 -
 sw/source/core/unocore/unosett.cxx                                 |    4 +--
 sw/source/core/unocore/unostyle.cxx                                |    4 +--
 sw/source/filter/ww8/ww8par5.cxx                                   |    4 +--
 10 files changed, 26 insertions(+), 24 deletions(-)

New commits:
commit f74142e6d02a65e811f9b84bada99b1489c0f9ff
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sun Apr 20 12:55:02 2025 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Sun Apr 20 22:15:20 2025 +0200

    cid#1646564 Unchecked dynamic_cast
    
    and
    
    cid#1646560 Unchecked dynamic_cast
    
    Change-Id: I6e66128418fa2c4fdd2f0a1430e8dd17b5e5c684
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184385
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx 
b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
index 156c755e45db..57fe3fd6f3d9 100644
--- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
@@ -635,13 +635,13 @@ void DataPointItemConverter::FillSpecialItem(
 
                 rOutItemSet.Put( SfxBoolItem( nWhichId, bValue ));
 
-                if( m_bOverwriteLabelsForAttributedDataPointsAlso )
+                DataSeries* pDataSeries = 
m_bOverwriteLabelsForAttributedDataPointsAlso
+                    ? dynamic_cast<DataSeries*>(GetPropertySet().get())
+                    : nullptr;
+                if (pDataSeries && 
pDataSeries->hasAttributedDataPointDifferentValue(
+                            CHART_UNONAME_LABEL, uno::Any(aLabel)))
                 {
-                    if( 
dynamic_cast<DataSeries*>(GetPropertySet().get())->hasAttributedDataPointDifferentValue(
-                            CHART_UNONAME_LABEL , uno::Any(aLabel) ) )
-                    {
-                        rOutItemSet.InvalidateItem(nWhichId);
-                    }
+                    rOutItemSet.InvalidateItem(nWhichId);
                 }
             }
         }
diff --git a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx 
b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx
index bd1c8bc73258..de12adcc9739 100644
--- a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx
@@ -550,13 +550,13 @@ void TextLabelItemConverter::FillSpecialItem( sal_uInt16 
nWhichId, SfxItemSet& r
 
                 rOutItemSet.Put(SfxBoolItem(nWhichId, bValue));
 
-                if (mbDataSeries)
-                {
-                    if 
(dynamic_cast<DataSeries*>(GetPropertySet().get())->hasAttributedDataPointDifferentValue(
+                DataSeries* pDataSeries = mbDataSeries
+                    ? dynamic_cast<DataSeries*>(GetPropertySet().get())
+                    : nullptr;
+                if (pDataSeries && 
pDataSeries->hasAttributedDataPointDifferentValue(
                             CHART_UNONAME_LABEL, uno::Any(aLabel)))
-                    {
-                        rOutItemSet.InvalidateItem(nWhichId);
-                    }
+                {
+                    rOutItemSet.InvalidateItem(nWhichId);
                 }
             }
         }
commit 82e35dbcf9bac39a781081fae3ea434cd7d70894
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sun Apr 20 12:51:46 2025 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Sun Apr 20 22:15:13 2025 +0200

    cid#1646566 Dereference null return value
    
    Change-Id: I7464dd0640119c2f3e6317fc0d2672aaf8019718
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184383
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins

diff --git a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx 
b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
index 10f673b01071..5483cfd766ab 100644
--- a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
@@ -927,6 +927,8 @@ bool Clipboard::PasteSlidesFromSystemClipboard()
     ViewShellBase* pBase = mrSlideSorter.GetViewShellBase();
     std::shared_ptr<DrawViewShell> pDrawViewShell(
         std::dynamic_pointer_cast<DrawViewShell>(pBase->GetMainViewShell()));
+    if (!pDrawViewShell)
+        return false;
     TransferableDataHelper aDataHelper(
         
TransferableDataHelper::CreateFromSystemClipboard(pDrawViewShell->GetActiveWindow()));
 
commit 06d4aadb011fe7aa0c3d4e1d779b165b593c9f21
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sun Apr 20 12:38:45 2025 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Sun Apr 20 22:15:06 2025 +0200

    cid#1555714 COPY_INSTEAD_OF_MOVE
    
    and
    
    cid#1556132 COPY_INSTEAD_OF_MOVE
    cid#1557140 COPY_INSTEAD_OF_MOVE
    cid#1557729 COPY_INSTEAD_OF_MOVE
    cid#1646558 COPY_INSTEAD_OF_MOVE
    cid#1646562 COPY_INSTEAD_OF_MOVE
    cid#1646563 COPY_INSTEAD_OF_MOVE
    cid#1646565 COPY_INSTEAD_OF_MOVE
    cid#1646567 COPY_INSTEAD_OF_MOVE
    cid#1646570 COPY_INSTEAD_OF_MOVE
    cid#1555021 COPY_INSTEAD_OF_MOVE
    
    Change-Id: Ibf73c38e83e3958dc4766cf2011298ce4cffe660
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184381
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 20e2f3926a33..c3cb3b0a6331 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -2262,7 +2262,7 @@ void SwEditShell::SetTextFormatColl(SwTextFormatColl 
*pFormat,
                     ( nPoolId == RES_POOLCOLL_STANDARD || 
!sParaStyleName.isEmpty() ) )
                 {
                     std::unique_ptr<SwRedlineExtraData_FormatColl> xExtra;
-                    xExtra.reset(new 
SwRedlineExtraData_FormatColl(sParaStyleName, nPoolId, nullptr));
+                    xExtra.reset(new 
SwRedlineExtraData_FormatColl(std::move(sParaStyleName), nPoolId, nullptr));
                     pRedline->SetExtraData( xExtra.get() );
                 }
             }
diff --git a/sw/source/core/txtnode/fmtatr2.cxx 
b/sw/source/core/txtnode/fmtatr2.cxx
index 49169f095f77..4a28121d2e20 100644
--- a/sw/source/core/txtnode/fmtatr2.cxx
+++ b/sw/source/core/txtnode/fmtatr2.cxx
@@ -405,7 +405,7 @@ bool SwFormatINetFormat::PutValue( const uno::Any& rVal, 
sal_uInt8 nMemberId )
                 rVal >>= sVal;
                 UIName aString;
                 SwStyleNameMapper::FillUIName( ProgName(sVal), aString, 
SwGetPoolIdFromName::ChrFmt );
-                msVisitedFormatName = aString;
+                msVisitedFormatName = std::move(aString);
                 mnVisitedFormatId = SwStyleNameMapper::GetPoolIdFromUIName( 
msVisitedFormatName,
                                                SwGetPoolIdFromName::ChrFmt );
             }
@@ -416,7 +416,7 @@ bool SwFormatINetFormat::PutValue( const uno::Any& rVal, 
sal_uInt8 nMemberId )
                 rVal >>= sVal;
                 UIName aString;
                 SwStyleNameMapper::FillUIName( ProgName(sVal), aString, 
SwGetPoolIdFromName::ChrFmt );
-                msINetFormatName = aString;
+                msINetFormatName = std::move(aString);
                 mnINetFormatId = SwStyleNameMapper::GetPoolIdFromUIName( 
msINetFormatName, SwGetPoolIdFromName::ChrFmt );
             }
             break;
diff --git a/sw/source/core/unocore/unochart.cxx 
b/sw/source/core/unocore/unochart.cxx
index c4b3bca7b8c7..22417ff0d7d3 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -445,7 +445,7 @@ static bool GetSubranges( std::u16string_view 
rRangeRepresentation,
 
                 // make sure to use only a single table
                 if (nCnt == 0)
-                    aFirstTable = aTableName;
+                    aFirstTable = std::move(aTableName);
                 else
                     if (aFirstTable != aTableName) bRes = false;
 
@@ -492,7 +492,7 @@ static void SortSubranges( uno::Sequence< OUString > 
&rSubRanges, bool bCmpByCol
                                 aSmallestStartCell, aSmallestEndCell, 
bCmpByColumn ))
             {
                 nIdxOfSmallest = k;
-                aSmallestTableName    = aTableName;
+                aSmallestTableName = std::move(aTableName);
                 aSmallestStartCell  = aStartCell;
                 aSmallestEndCell    = aEndCell;
             }
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx 
b/sw/source/core/unocore/unocrsrhelper.cxx
index dc7f023d47d2..91d897292d6d 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -1393,7 +1393,7 @@ void makeRedline( SwPaM const & rPaM,
                 SwStyleNameMapper::FillUIName(ProgName(sParaStyleName), 
sUIStyle,
                                               SwGetPoolIdFromName::TxtColl);
                 xRedlineExtraData.reset(new SwRedlineExtraData_FormatColl(
-                    sUIStyle.isEmpty() ? UIName(sParaStyleName) : sUIStyle, 
nStylePoolId, &aItemSet));
+                    sUIStyle.isEmpty() ? UIName(sParaStyleName) : 
std::move(sUIStyle), nStylePoolId, &aItemSet));
             }
             else if (eType == RedlineType::ParagraphFormat)
                 xRedlineExtraData.reset(new SwRedlineExtraData_FormatColl( 
UIName(u""_ustr), RES_POOLCOLL_STANDARD, nullptr ));
diff --git a/sw/source/core/unocore/unosett.cxx 
b/sw/source/core/unocore/unosett.cxx
index 26158000fb1c..b007e6558d47 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -1840,7 +1840,7 @@ void SwXNumberingRules::SetPropertiesToNumFormat(
                 rCharStyleName = UIName();
             }
             else
-                rCharStyleName = sCharFormatName;
+                rCharStyleName = std::move(sCharFormatName);
         }
         else if (rProp.Name == UNO_NAME_START_WITH)
         {
@@ -2096,7 +2096,7 @@ void SwXNumberingRules::SetPropertiesToNumFormat(
                 rProp.Value >>= uTmp;
                 UIName sStyleName;
                 SwStyleNameMapper::FillUIName(ProgName(uTmp), sStyleName, 
SwGetPoolIdFromName::TxtColl );
-                *pHeadingStyleName = sStyleName;
+                *pHeadingStyleName = std::move(sStyleName);
             }
         }
         else if (rProp.Name == UNO_NAME_BULLET_REL_SIZE)
diff --git a/sw/source/core/unocore/unostyle.cxx 
b/sw/source/core/unocore/unostyle.cxx
index f83b20075526..ada9cd8e0320 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1426,7 +1426,7 @@ void SwXStyle::setName(const OUString& rProgName)
     rtl::Reference<SwDocStyleSheet> xTmp(new 
SwDocStyleSheet(*static_cast<SwDocStyleSheet*>(pBase)));
     if (!xTmp->SetName(sUIName.toString()))
         throw uno::RuntimeException();
-    m_sStyleUIName = sUIName;
+    m_sStyleUIName = std::move(sUIName);
 }
 
 sal_Bool SwXStyle::isUserDefined()
@@ -4868,7 +4868,7 @@ rtl::Reference<SwXTextCellStyle> 
SwXTextCellStyle::CreateXTextCellStyle(SwDocShe
         xTextCellStyle = pBoxFormat->GetXObject();
         if (!xTextCellStyle.is())
         {
-            xTextCellStyle.set(new SwXTextCellStyle(pDocShell, pBoxFormat, 
sParentName));
+            xTextCellStyle.set(new SwXTextCellStyle(pDocShell, pBoxFormat, 
std::move(sParentName)));
             pBoxFormat->SetXObject(xTextCellStyle);
         }
     }
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index a37f24c798ac..1c539bc24405 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -2202,7 +2202,7 @@ eF_ResT SwWW8ImplReader::Read_F_Ref( WW8FieldDesc*, 
OUString& rStr )
 
     SwGetRefField aField(
         
static_cast<SwGetRefFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(
 SwFieldIds::GetRef )),
-        sBkmName,u""_ustr,REF_BOOKMARK,0,0,eFormat);
+        std::move(sBkmName), u""_ustr, REF_BOOKMARK, 0, 0, eFormat);
 
     if (eFormat == REF_CONTENT)
     {
@@ -2337,7 +2337,7 @@ eF_ResT SwWW8ImplReader::Read_F_PgRef( WW8FieldDesc*, 
OUString& rStr )
         sPageRefBookmarkName = ReferenceMarkerName(sName);
     }
     SwGetRefField aField( 
static_cast<SwGetRefFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(
 SwFieldIds::GetRef )),
-                        sPageRefBookmarkName, u""_ustr, REF_BOOKMARK, 0, 0, 
REF_PAGE );
+                        std::move(sPageRefBookmarkName), u""_ustr, 
REF_BOOKMARK, 0, 0, REF_PAGE );
     m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, 
SwFormatField( aField ) );
 
     return eF_ResT::OK;

Reply via email to