sw/source/ui/dbui/customizeaddresslistdialog.cxx |    2 +-
 sw/source/uibase/utlui/glbltree.cxx              |    6 ++++++
 tools/source/xml/XPath.cxx                       |   12 +++++++-----
 3 files changed, 14 insertions(+), 6 deletions(-)

New commits:
commit 8ff76955c60e554afe6f75dd3dbf22fa68710403
Author:     Caolán McNamara <[email protected]>
AuthorDate: Mon Dec 22 19:12:38 2025 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Mon Dec 22 22:25:36 2025 +0100

    cid#1676285 Improper use of negative value
    
    and
    
    cid#1676283 Argument cannot be negative
    
    Change-Id: I0096d15eb76f1e481a5c3a3ea8f69385c8eed93a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196109
    Reviewed-by: Caolán McNamara <[email protected]>
    Tested-by: Jenkins

diff --git a/sw/source/ui/dbui/customizeaddresslistdialog.cxx 
b/sw/source/ui/dbui/customizeaddresslistdialog.cxx
index cd1a2acc2893..68d38a45ed79 100644
--- a/sw/source/ui/dbui/customizeaddresslistdialog.cxx
+++ b/sw/source/ui/dbui/customizeaddresslistdialog.cxx
@@ -121,7 +121,7 @@ IMPL_LINK_NOARG(SwCustomizeAddressListDialog, 
DeleteHdl_Impl, weld::Button&, voi
 IMPL_LINK(SwCustomizeAddressListDialog, UpDownHdl_Impl, weld::Button&, 
rButton, void)
 {
     auto nPos = m_xFieldsLB->get_selected_index();
-    assert(nPos && "nothing selected");
+    assert(nPos != -1 && "nothing selected");
     auto nOldPos = nPos;
     OUString aTemp = m_xFieldsLB->get_text(nPos);
     m_xFieldsLB->remove(nPos);
diff --git a/sw/source/uibase/utlui/glbltree.cxx 
b/sw/source/uibase/utlui/glbltree.cxx
index 6553f8e3d778..35aa93c8ad51 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -398,6 +398,12 @@ void SwGlobalTree::MoveSelectionTo(const weld::TreeIter* 
pDropEntry)
 {
     int nSource = m_xTreeView->get_selected_index();
 
+    if (nSource == -1)
+    {
+        SAL_WARN("sw", "No selection to move");
+        return;
+    }
+
     int nDest = pDropEntry ? m_xTreeView->get_iter_index_in_parent(*pDropEntry)
                            : m_pSwGlblDocContents->size();
 
commit 180df836646c011877363b3b75ecafe28f6f70d4
Author:     Caolán McNamara <[email protected]>
AuthorDate: Mon Dec 22 19:10:17 2025 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Mon Dec 22 22:25:29 2025 +0100

    cid#1677777 Unchecked return value
    
    Change-Id: I0e104a3931164a7ff26a807897327c2aa84011c3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196108
    Reviewed-by: Caolán McNamara <[email protected]>
    Tested-by: Caolán McNamara <[email protected]>

diff --git a/tools/source/xml/XPath.cxx b/tools/source/xml/XPath.cxx
index e87d7f449de1..567a93dbcc56 100644
--- a/tools/source/xml/XPath.cxx
+++ b/tools/source/xml/XPath.cxx
@@ -16,11 +16,13 @@ namespace
 OUString convert(xmlChar const* sXmlString)
 {
     OUString sString;
-    rtl_convertStringToUString(&sString.pData, reinterpret_cast<char 
const*>(sXmlString),
-                               xmlStrlen(sXmlString), RTL_TEXTENCODING_UTF8,
-                               RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR
-                                   | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
-                                   | RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR);
+    bool bSuccess = rtl_convertStringToUString(
+        &sString.pData, reinterpret_cast<char const*>(sXmlString), 
xmlStrlen(sXmlString),
+        RTL_TEXTENCODING_UTF8,
+        RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR | 
RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
+            | RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR);
+    (void)bSuccess;
+    assert(bSuccess);
     return sString;
 }
 }

Reply via email to